Skip to content

fix(yara): require a browser cookie-store path in info_stealer - #752

Merged
rng1995 merged 3 commits into
NVIDIA:mainfrom
elliottwaves-20:fix/751-info-stealer-cookie-path
Oct 31, 2026
Merged

rng1995 merged 3 commits into
NVIDIA:mainfrom
elliottwaves-20:fix/751-info-stealer-cookie-path

Conversation

@elliottwaves-20

@elliottwaves-20 elliottwaves-20 commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #751.

The built-in info_stealer rule matched $browser_cookies = /Cookies.*(chrome|firefox|edge|opera)/ nocase across a whole line. Because the condition is any of them, documentation that names cookies and, later on the same line, a browser or "Edge Functions" raised a HIGH YR1 finding. The supabase skill description in #751 is one example.

This change keeps the rule's intent and requires code context. It matches one of these:

  • a browser profile path that ends in the cookie store;
  • the store name followed on the line by a browser name in code: part of an identifier (chrome_profile, opera.profile), a path segment (/chromium/, google-chrome/), a quoted string ("edge"), or a glob ('*chrome*').

This way, code that names the store first is still caught. The change also adds the Opera (Opera Stable / Opera GX Stable) and Firefox (cookies.sqlite) store forms. All other strings of the rule are unchanged.

$browser_cookies  = /(Chrome|Chromium|Edge|Brave-Browser)\w*[\\\/'\x22, ]{1,5}(User Data[^\n]{0,80}|(Default|Profile \d+)[\\\/'\x22, ]{1,5}(Network[\\\/'\x22, ]{1,5})?)Cookies/ nocase
$cookies_browser  = /Cookies[^\n]{0,80}([^a-z](chrome|chromium|edge|brave|opera|firefox)(_|\.\w|[(*])|[\\\/\-.'\x22](chrome|chromium|edge|brave|opera|firefox)[\\\/]|['\x22](chrome|chromium|edge|brave|opera|firefox)['\x22])/ nocase
$opera_cookies    = /Opera (Stable|GX Stable)[^\n]{0,80}Cookies/ nocase
$firefox_cookies  = /cookies\.sqlite/ nocase

The previous pattern also needed Cookies before the browser name. The usual path forms put the browser first and Cookies last, so they did not match unless something else followed on the line. The new strings cover those forms.

A quote counts only when it encloses the browser name. A slash or backslash after the browser name counts only after a path character or a quote. So prose such as blocked by Chrome's tracking protection or Cookies: Chrome/Edge supported does not match.

Known trade-offs

  • Some store-first forms that the old pattern matched no longer match. These are a browser name followed by ) or ] (get_cookies(chrome)), a browser name at the end of the line, and a browser name more than 80 characters after Cookies. ) is left out on purpose, because (Chrome) is a common parenthetical in prose. A real stealer usually also names the store path, which $browser_cookies catches.
  • cookies.sqlite is a bare token, like wallet.dat and ntds.dit in this rule. A document that names the Firefox cookie store gets HIGH YR1.

Tests

tests/nodes/analyzers/test_static_yara.py, following the #489 pattern:

  • test_info_stealer_ignores_cookie_prose: the False positive: info_stealer $browser_cookies matches prose that mentions cookies and Edge on one line #751 description and eight short documentation sentences, including two possessives and a browser list with a slash.
  • test_info_stealer_matches_browser_cookie_store_paths: Chrome/Edge on Windows, Brave on Linux, Chrome on macOS, Opera, Firefox, and the spaced pathlib form. The fixtures are base64-encoded, as for the webshell families.
  • test_info_stealer_matches_code_naming_the_store_first: nine code forms that name the store first, then the browser.
  • test_info_stealer_matches_cookie_store_path_next_to_prose: a store path after benign prose in one file.

Validation

  • pytest tests/nodes/analyzers/test_static_yara.py: 379 passed.
  • Against the rule on main, the info_stealer tests give 18 failed, 8 passed. The 8 that pass are seven store-first code forms and the mixed case. The other two code forms (os.path.join(CHROME_DIR, "Default", "Cookies") and a "chromium/" path segment) are newly caught.
  • Over 14,324 local skill and plugin files, the final rule matches no file outside this rule's own test fixtures. The rule on main matched requests/cookies.py.
  • Full suite on Windows: the same failures as unchanged main on this machine, none in YARA.
  • ruff check and ruff format --check on the changed test file: clean.

🤖 Generated with Claude Code

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[SkillSpector Review]

@elliottwaves-20 thank you for tracing the #751 false positive to the unbounded $browser_cookies string, and for testing benign prose, the real cookie-store paths and the store-first code forms.

Value and readiness

This fixes a real HIGH YR1 false positive that blocks documentation-only skills. It also closes the gap where the old pattern missed the usual browser-first store paths. The approach is right, but the PR isn't ready yet, for two reasons. The branch now conflicts with main. And the new $cookies_browser string still fires on a common kind of prose, which is the same false-positive class this PR fixes.

Material findings

  1. Blocker: src/skillspector/yara_rules/malware.yar.b64 conflicts with main (GitHub reports CONFLICTING). #608 changed the ransomware_behavior strings above info_stealer, so every base64 line after that point differs and git can't merge the two encodings. Please rebase, apply the info_stealer change to main's decoded rules, and re-encode. The test file merges cleanly.

  2. Blocker: the trailing class of $cookies_browser, [\\\/'\x22(], accepts an apostrophe, so an English possessive counts as code context. Both of these still match, so a cookie or auth doc still gets HIGH YR1 and a blocking verdict, as in #751:

    • Third-party cookies are blocked by Chrome's tracking protection.
    • Session cookies are dropped by Firefox's Enhanced Tracking Protection.

    One fix that keeps "edge", 'chrome' and every current fixture: count a quote only when it encloses the browser name, as in ['\x22](chrome|...|firefox)['\x22]. Keep [^a-z](...)(_|\.\w|[\\\/(]) for identifiers and paths. Please add both sentences to _COOKIE_PROSE (tests/nodes/analyzers/test_static_yara.py:633-641).

  3. Optional: $browser_cookies allows 1-4 separator characters, so the spaced pathlib form Path.home() / "AppData" / "Local" / "Google" / "Chrome" / "User Data" / "Default" / "Network" / "Cookies" matches neither new string. Here " / " is five characters, and Cookies comes last. main misses this too, so it isn't a regression. It is the common Python spelling, though, so {1,5} and a fixture would make the "browser first" coverage hold.

  4. Optional: the PR body says nothing main caught is lost. That is true for the six tested forms only. Store-first code where the browser is followed by ) or ], or sits more than 80 characters after Cookies, matched before and no longer does. Examples are get_cookies(chrome) and find ~ -name Cookies -path '*chrome*'. That may be a fair price for precision, but please say so in the body, or add ) to the follow set and recheck the prose corpus.

PIC tradeoffs

$firefox_cookies (cookies\.sqlite) is a bare-token string, like wallet.dat and ntds.dit. Any document that names Firefox's cookie store will now get HIGH YR1, for example a yt-dlp or browser-automation skill README. That is consistent with this rule's style, but the PIC should confirm it.

Verification and gaps

  • I decoded the merge-base, head and current-main copies of malware.yar.b64 with base64 -d and diffed them.
    • The PR changes only info_stealer, replacing one string with four.
    • main differs only in the ransomware strings. git merge-tree confirms the conflict is limited to the .b64 file.
  • I decoded the 12 base64 test fixtures. I traced them, the six prose lines and the examples above through the four regexes by hand.
  • Per instructions, I didn't run the rule, YARA or the tests. All 6 CI checks passed at 345d34a.

@elliottwaves-20
elliottwaves-20 force-pushed the fix/751-info-stealer-cookie-path branch from 345d34a to db2c857 Compare October 13, 2026 10:10
@elliottwaves-20

Copy link
Copy Markdown
Contributor Author

@rng1995 I addressed all four points. The branch is rebased onto main (b07f181).

  1. Conflict. I decoded main's malware.yar.b64, applied only the info_stealer strings and re-encoded it in the same format (base64.encodebytes, 76 columns, LF). Decoded against main, the diff touches only the info_stealer strings: one line removed, four added. The ransomware changes from fix(yara): avoid ransomware findings for Bitcoin payment prose #608 are untouched.
  2. Possessives. A quote now counts only when it encloses the browser name: ['\x22](chrome|…|firefox)['\x22]. I applied the same idea to the slash: / or \ after the browser name counts only when a path character or a quote precedes it (/chromium/, google-chrome/, "chromium/). Without that, Cookies: Chrome/Edge supported in prose still matched, on main too. Both of your sentences and that one are now in _COOKIE_PROSE. Two code fixtures make sure quoted and dashed path segments still match.
  3. Spaced pathlib. $browser_cookies now allows {1,5} separators, with your Path.home() / … / "Cookies" example as a fixture.
  4. Store-first forms lost against main. I added the glob star to the follow set, so find ~ -name Cookies -path '*chrome*' matches again (fixture added). get_cookies(chrome), a browser name followed by ) or ], and a browser name more than 80 characters after Cookies still do not match. I left ) out because (Chrome) is a common parenthetical in prose. I updated the PR body to state this.

cookies.sqlite (PIC): I kept it as a bare token, in line with wallet.dat and ntds.dit. As you say, a document that names the Firefox cookie store gets HIGH YR1. Over 14,324 local skill and plugin files, the final rule matches no file outside this rule's own test fixtures. The rule on main matched requests/cookies.py.

Verification (Windows):

  • tests/nodes/analyzers/test_static_yara.py: 379 passed. Against main's rule, the info_stealer tests give 18 failed, 8 passed. The 8 that pass are seven store-first code forms and the mixed prose case, so main still matches those forms.
  • Full suite: the same failures as unchanged main on this machine, none in YARA. One timing test failed only under parallel load and passes alone.
  • ruff check and ruff format --check on the test file: clean.

🤖 Generated with Claude Code

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[SkillSpector Review]

Value and readiness

Ready on this head. The previous possessive-prose blocker is fixed, the requested path fixture improvements are present and GitHub reports the branch mergeable.

Material findings

No new or still-open required changes found. The earlier quote issue is closed by requiring a browser-enclosing quote pair; both possessive sentences and the Chrome/Edge prose control are in the tests. Decoded comparison confirms unrelated ransomware changes are preserved, resolving the earlier encoded-file conflict.

PIC tradeoffs

Accept the documented precision tradeoff: bare cookies.sqlite remains a HIGH signature, and store-first browser identifiers followed only by ) or ] or separated by more than 80 characters lose this one signature. These limitations are explicit and were optional in the previous review; the browser-first artifact paths gain coverage.

Verification and gaps

Reviewed the complete diff, description, linked issue material, all previous reviews/comments/replies and pinned-head surrounding source at db2c85744fa935cdac244e48c79077970a8a2596. Decoded base/head as data and confirmed only info_stealer strings differ. Read all prior review/reply material, all encoded fixtures and the prose controls; verified the five-character separator, quoted/dashed path and glob follow-set changes. GitHub reports changes: SUCCESS, lint: SUCCESS, test-unit: SUCCESS, OpenCode TypeScript Tests: SUCCESS, DCO Check: SUCCESS, docker-smoke: SUCCESS. No contributor code, tests, imports, build steps or scanner invocations were executed during this review.

elliottwaves-20 and others added 3 commits October 29, 2026 21:36
$browser_cookies matched /Cookies.*(chrome|firefox|edge|opera)/ across a
whole line, so documentation naming cookies and, later on the line, a
browser or Edge Functions raised a HIGH info_stealer finding. Require a
browser profile path that ends in the cookie store instead, and add the
Opera and Firefox store forms. Every other string of the rule is unchanged.

Fixes NVIDIA#751

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: elliottwaves-20 <pail1217@web.de>
The first change only matched the browser-before-store order, so code such
as sqlite3.connect(chrome_profile + "/Cookies") that the previous pattern
caught no longer matched. Add $cookies_browser for the store-first order
with a browser name that is part of an identifier, path or string, and let
$browser_cookies accept an identifier suffix (CHROME_DIR). Regression
tests cover six such code forms and two more prose sentences.

Refs NVIDIA#751

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: elliottwaves-20 <pail1217@web.de>
$cookies_browser accepted an apostrophe after the browser name, so English
possessives such as "blocked by Chrome's tracking protection" still gave
HIGH YR1. A quote now counts only when it encloses the browser name
("edge", 'chrome'). A slash or backslash after the browser name counts
only when a path character or quote precedes it (/chromium/,
google-chrome/, "chromium/), so a browser list such as "Chrome/Edge"
in prose no longer matches. Identifiers keep the (_|\.\w|[(]) follow
set, which now also accepts a glob star (-path '*chrome*').

$browser_cookies allows up to five separator characters, so the spaced
pathlib form Path.home() / "Chrome" / "User Data" / ... / "Cookies"
matches.

Refs NVIDIA#751

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: elliottwaves-20 <pail1217@web.de>
@elliottwaves-20
elliottwaves-20 force-pushed the fix/751-info-stealer-cookie-path branch from db2c857 to d258a90 Compare October 29, 2026 20:44
@elliottwaves-20

Copy link
Copy Markdown
Contributor Author

Rebased onto main (54921c8c) to resolve the malware.yar.b64 conflict with #860. The info_stealer rule is byte-identical to the approved head db2c8574; decoded against main, only the info_stealer strings differ, and the new ransomware_behavior_multiline rule is preserved. test_static_yara.py: 386 passed; the 3 failures in TestRuleSkipAccounting (from #919) fail identically on unchanged main on Windows.

🤖 Generated with Claude Code

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[SkillSpector Review]

Value and readiness

Ready for code approval at d258a90f3fa662e87045f9a7732db02df447b9c7. The rebase resolves the encoded-rule conflict while preserving the previously approved cookie-rule behavior and the newer ransomware signatures. All six hosted checks pass. The unresolved review conversation still needs disposition before merge.

Material findings

No new or still-open required code changes found. Decoding base/head as data shows that only the info_stealer strings differ; every unrelated rule, including ransomware_behavior_multiline from #860, is preserved. The complete info_stealer rule is byte-identical to approved head db2c8574, and all 82 added test lines are unchanged.

Verified every prior point: browser-enclosing quotes prevent the two possessive-prose false positives; both sentences and the Chrome/Edge prose control remain in _COOKIE_PROSE; five-character separators retain spaced pathlib paths; quoted/dashed browser path segments and the store-first glob remain covered. The author explicitly documents the remaining store-first limitations. The original inline issue is resolved in source although its conversation remains open.

PIC tradeoffs

The documented precision tradeoffs remain: bare cookies.sqlite is still a HIGH signature, while store-first browser identifiers followed only by ) or ], at end of line, or beyond the 80-character span lose this one signature. Browser-first profile paths gain coverage. These limitations were explicit and optional in the earlier approval.

Verification and gaps

Read the complete two-file diff, linked #751, all earlier reviews/replies, the new rebase explanation and pinned loader/test context. Decoded all 16 added code/path fixtures as inert data, checked the nine prose controls, and compared the decoded rules against current base 54921c8c and the prior approved source. Hosted checks: changes, lint, test-unit, OpenCode TypeScript Tests, DCO Check and docker-smoke all SUCCESS. GitHub reports MERGEABLE / BLOCKED; the unresolved conversation remains a separate merge gate. Static review only: no contributor code, YARA rules, tests, imports, builds or scanner invocations were executed.

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[SkillSpector Review]

Value and readiness

Approval remains appropriate at the unchanged reviewed head. The author has now resolved the last conversation, removing yesterday's thread gate.

Material findings

No new or still-open required changes found. Rechecked the resolved possessive-prose finding against the prior exact-head assessment: quoted browser/store boundaries and the corresponding prose/path controls remain present. The unchanged approved head preserves every unrelated rule, including the ransomware signatures. Thread resolution is supported by the already verified source fix; resolution alone was not treated as proof.

PIC tradeoffs

The previously documented bounded cookie-path recognition tradeoffs remain unchanged; no new product decision identified.

Verification and gaps

Read the current full two-file diff, marked review history, resolution/reply state and prior pinned decoded rules/test proof. Current head d258a90 matches the exact commit fully assessed yesterday. All six hosted checks succeeded; final merge gates are checked separately. No contributor code, tests, snippets, imports, builds, model calls or scanner invocations were executed.

Reviewed head: d258a90f3fa662e87045f9a7732db02df447b9c7.

@rng1995
rng1995 merged commit 988effa into NVIDIA:main Oct 31, 2026
6 checks passed
rng1995 pushed a commit that referenced this pull request Nov 2, 2026
* fix(yara): require a browser cookie-store path in info_stealer

$browser_cookies matched /Cookies.*(chrome|firefox|edge|opera)/ across a
whole line, so documentation naming cookies and, later on the line, a
browser or Edge Functions raised a HIGH info_stealer finding. Require a
browser profile path that ends in the cookie store instead, and add the
Opera and Firefox store forms. Every other string of the rule is unchanged.

Fixes #751

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: elliottwaves-20 <pail1217@web.de>

* fix(yara): keep info_stealer matches on code that names the store first

The first change only matched the browser-before-store order, so code such
as sqlite3.connect(chrome_profile + "/Cookies") that the previous pattern
caught no longer matched. Add $cookies_browser for the store-first order
with a browser name that is part of an identifier, path or string, and let
$browser_cookies accept an identifier suffix (CHROME_DIR). Regression
tests cover six such code forms and two more prose sentences.

Refs #751

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: elliottwaves-20 <pail1217@web.de>

* fix(yara): count a quote in info_stealer only around the browser name

$cookies_browser accepted an apostrophe after the browser name, so English
possessives such as "blocked by Chrome's tracking protection" still gave
HIGH YR1. A quote now counts only when it encloses the browser name
("edge", 'chrome'). A slash or backslash after the browser name counts
only when a path character or quote precedes it (/chromium/,
google-chrome/, "chromium/), so a browser list such as "Chrome/Edge"
in prose no longer matches. Identifiers keep the (_|\.\w|[(]) follow
set, which now also accepts a glob star (-path '*chrome*').

$browser_cookies allows up to five separator characters, so the spaced
pathlib form Path.home() / "Chrome" / "User Data" / ... / "Cookies"
matches.

Refs #751

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: elliottwaves-20 <pail1217@web.de>

---------

Signed-off-by: elliottwaves-20 <pail1217@web.de>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 988effa)
Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com>
@rng1995 rng1995 mentioned this pull request Nov 16, 2026
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.

False positive: info_stealer $browser_cookies matches prose that mentions cookies and Edge on one line

2 participants