Skip to content

fix(yara): require corroborating webshell markers - #489

Open
mohgupta-ship-it wants to merge 4 commits into
mainfrom
codex/fix-webshell-signature-precision
Open

fix(yara): require corroborating webshell markers#489
mohgupta-ship-it wants to merge 4 commits into
mainfrom
codex/fix-webshell-signature-precision

Conversation

@mohgupta-ship-it

Copy link
Copy Markdown
Member

Summary

  • Replace prose-colliding family names with implementation-specific markers.
  • Require corroborating WSO markers and pair the Behinder key with a server-language tag before emitting a critical finding.
  • Cover benign prose, isolated indicators, mixed-case markers, and representative family samples.

This builds on #488 and preserves the original author attribution while tightening the single-marker cases found during validation.

Fixes #487

Validation

  • make lint
  • make format-check
  • Focused YARA analyzer suite: 90 passed
  • Full Python 3.12 suite: 3,989 passed, 14 skipped, 4 xfailed
  • make docker-smoke

Submitted by Codex on behalf of Mohit Gupta.

stefanoamorelli and others added 4 commits September 6, 2026 17:39
`php_webshell_known` matched the bare substrings "behinder" and "WSO "
under `any of them`, so ordinary prose produced a CRITICAL YR2 finding
at 0.9 confidence with a remediation telling the reader to remove a
webshell. The German words "behindert" and "Behinderung" contain the
first string, and the product name "WSO 2 Micro Integrator" contains
the second, as reported in #487.

Behinder is now identified by its hardcoded AES key, md5("rebeyond")
truncated to 16 characters, which its PHP, ASP and JSP shells share and
which signature-base [1] uses for the same purpose. The key is written
as a YARA hex string so the packaged rule file does not carry the
indicator in plaintext, in the spirit of the encoded malware rules. WSO is identified
by the helper names oRb introduced in 2.x: `wsoEx(`, `WSO_VERSION` and
`wsoSecParam`. I checked a WSO 2.5 source against the old and new rule:
the old one hit only the banner and the bare "WSO " string, the new one
hits the banner and all three helpers, so no known sample is lost.

I preferred narrowing the strings over a `fullword` modifier because a
document that names the Behinder family would still have scored
CRITICAL, and "WSO 2" would still have matched.

Fixes #487

[1]: https://github.com/Neo23x0/signature-base

Signed-off-by: Stefano Amorelli <stefano@amorelli.tech>
The benign cases are the two reproductions from #487 plus a document
that names the Behinder and WSO families without shipping them. The
malicious cases are a Behinder PHP shell, a Behinder JSP shell and a
WSO fragment carrying `WSO_VERSION` and `wsoEx(`. All six fail against
the previous rule: the prose cases fired and the samples were missed,
so the tests guard both directions. The samples are base64-encoded like
the existing reverse shell fixture so the indicators do not sit in the
repository in plaintext.

Signed-off-by: Stefano Amorelli <stefano@amorelli.tech>
Group family-specific indicators so isolated constants and documented keys do not produce critical findings.

Prepared by Codex on behalf of Mohit Gupta.

Signed-off-by: Mohit Gupta <mohgupta@nvidia.com>
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: php_webshell_known fires on the German word "behindert" and on "WSO " in prose

2 participants