Skip to content

fix(malware-scan): cut false positives from vendor bundles and require() calls - #30

Merged
Satendra-SR merged 1 commit into
mainfrom
fix/scanner-false-positives
Sep 25, 2026
Merged

Satendra-SR merged 1 commit into
mainfrom
fix/scanner-false-positives

Conversation

@Satendra-SR

Copy link
Copy Markdown
Member

Summary

Cuts false HIGH findings from the malware scanner without weakening detection of the real payload. On kdn-website the scanner reported 12 HIGH, all from JSDoc comments in Elementor's bundled AI scripts, such as ai-admin.js:16199:

 * @param {Object}<155 spaces>options

That's formatting inside a comment, not hidden code.

Changes (malware-scan/scan_malicious.py)

  • WHITESPACE_PADDING: now low (hidden by default) outside config files when nothing code-like follows the padding and either:

    • the hidden text is short (under 200 characters), or
    • the line is a comment (*, //, /*, #).

    It stays high when code-like tokens are hidden (require(, global[/global., eval(, Function(, fromCharCode, child_process, _$_xxxx, import(, URLs, atob(, Buffer.from), or 200+ characters of non-comment text. It's always high in config files (*.config.*), where the payload is injected.

  • GLOBAL_REQUIRE: no longer matches storing a require() call result (global.performance = require("perf_hooks"), found in Moodle's ogv.js WASM decoders). It still matches assigning the require function itself (global['r'] = require, global[_$_a291[0x11]] = require), as the payload does.

  • malware-scan/README.md: rules table updated.

Verification (text-only; no sample executed)

Sample set Before After
10 real infected files (coloredcow esbuild.config.js; sankalptaru-website build-js.js + rank-math webpack.config.js; sankalptaru-huge react-native.config.js; sankalptaru-mobile metro.config.js; Internal-intelligence-platform server.js + postcss.config.mjs; pai postcss.config.mjs; volunteer-module index.js; sparklegacy postcss.config.js) 4–6 high each unchanged, same rules
Elementor AI bundles (kdn-website) 12 high 0 high (whitespace → low)
Figma plugin-api-standalone.d.ts 5 high 0 high
Moodle ogv-decoder-*-wasm.js 3 high not flagged
kdn-website, whole repo 12 high 0 high

Synthetic edge cases:

Case Result
Comment line hiding */require(...) high
Code line hiding 250 characters high
Padded comment in tailwind.config.js high
Short payload shape (global.o=...;var _$_ab12) high
Long JSDoc text after padding low

After merge

  • Bump the pinned SHA in consumer workflows (sankalptaru-website #813, coloredcow #1513) and in the team guide's YAML snippet.
  • Anyone with the cc-malware-scan skill installed should re-run the install block to get the new scanner.

🤖 Generated with Claude Code

…e() calls

WHITESPACE_PADDING is now low outside config files when nothing code-like
is hidden after the padding and either the hidden text is short or the line
is a comment (aligned JSDoc/tables in vendor bundles and .d.ts files, e.g.
Elementor's " * @PARAM {Object}<155 spaces>options"). Low is hidden by
default. It stays high when code-like tokens (require(, global[, eval(,
fromCharCode, _$_xxxx, URLs) or 200+ characters of non-comment text are
hidden, and always high in config files.

GLOBAL_REQUIRE no longer matches storing a require() call result
(global.performance = require("perf_hooks")); it still matches assigning
the require function itself (global['r'] = require), as the payload does.

Checked against 10 real infected samples (all still 4-6 high, same rules)
and 3 false-positive sets (Elementor AI bundles, Figma .d.ts, Moodle ogv.js
WASM decoders: 20 high -> 0 high). kdn-website: 12 high -> 0 high.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Satendra-SR

Copy link
Copy Markdown
Member Author

Made some changes to remove some white listing false cases - came from KDN website

@Satendra-SR
Satendra-SR merged commit 320154b into main Sep 25, 2026
1 check passed
@Satendra-SR
Satendra-SR deleted the fix/scanner-false-positives branch September 25, 2026 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant