@@ -98,17 +98,48 @@ using Jest in `.jazzerjsrc.json`:
9898{ " disableBugDetectors" : [" prototype-pollution" ] }
9999` ` `
100100
101- ## Remote Code Execution
101+ ## Code Injection
102102
103- Hooks the ` eval ` and ` Function ` functions and reports a finding if the fuzzer
104- was able to pass a special string to ` eval ` and to the function body of
105- ` Function ` .
103+ Installs a canary on ` globalThis ` and hooks the ` eval ` and ` Function ` functions.
104+ The before-hooks guide the fuzzer toward injecting the active canary identifier
105+ into code strings. The detector reports two fatal stages by default:
106106
107- _Disable with:_ ` -- disableBugDetectors= remote- code- execution` in CLI mode; or
108- when using Jest in ` .jazzerjsrc .json ` :
107+ - ` Potential Code Injection (Canary Accessed)` - some code resolved the canary.
108+ This high-recall heuristic catches cases where dynamically produced code reads
109+ or stores the canary before executing it later.
110+ - ` Confirmed Code Injection (Canary Invoked)` - the callable canary returned by
111+ the getter was invoked.
112+
113+ The detector can be configured in the
114+ [custom hooks](./fuzz-settings.md#customhooks--arraystring) file.
115+
116+ - ` disableAccessReporting` - disables the stage-1 access finding while keeping
117+ invocation reporting active.
118+ - ` disableInvocationReporting` - disables the stage-2 invocation finding.
119+ - ` ignoreAccess (rule)` - suppresses stage-1 findings matching a file, function,
120+ or stack pattern.
121+ - ` ignoreInvocation (rule)` - suppresses stage-2 findings matching a file,
122+ function, or stack pattern.
123+
124+ Here is an example configuration in the
125+ [custom hooks](./fuzz-settings.md#customhooks--arraystring) file:
126+
127+ ` ` ` javascript
128+ const { getBugDetectorConfiguration } = require (" @jazzer.js/bug-detectors" );
129+
130+ getBugDetectorConfiguration (" code-injection" )
131+ ? .ignoreAccess ({
132+ filePattern: / handlebars[\\ /] dist[\\ /] cjs[\\ /] runtime\. js$ / ,
133+ functionPattern: / ^ lookupProperty$ / ,
134+ })
135+ ? .disableInvocationReporting ();
136+ ` ` `
137+
138+ _Disable with:_ ` -- disableBugDetectors= code- injection` in CLI mode; or when
139+ using Jest in ` .jazzerjsrc .json ` :
109140
110141` ` ` json
111- { " disableBugDetectors" : [" remote- code-execution " ] }
142+ { " disableBugDetectors" : [" code-injection " ] }
112143` ` `
113144
114145## Server-Side Request Forgery (SSRF)
0 commit comments