Skip to content

feat: add eval($variable) malware pattern to file scanner#175

Closed
tomepajk wants to merge 2 commits intodevfrom
feature/security-eval-add
Closed

feat: add eval($variable) malware pattern to file scanner#175
tomepajk wants to merge 2 commits intodevfrom
feature/security-eval-add

Conversation

@tomepajk
Copy link
Copy Markdown
Collaborator

Summary

  • Adds a standalone eval($variable) pattern (risk score 9.0) to the file scanner's malware detection
  • Fixes a gap where the totally-legit-seo simulated hack was missed because eval() and base64_decode() were split across separate lines, evading the existing eval(base64_decode(...)) combined pattern
  • The standalone base64_decode pattern only scores 5.0 (below the 6.0 risk threshold), so the hack was filtered out entirely

Test plan

  • Run the "Check If Hacked" workflow with the totally-legit-seo plugin installed and verify eval($decoded) is now flagged
  • Verify no false positives on legitimate plugins using eval() with string literals
  • Run composer lint to confirm PHP coding standards

🤖 Generated with Claude Code

tomepajk and others added 2 commits March 22, 2026 10:44
The file scanner missed the totally-legit-seo simulated hack because
eval() and base64_decode() were on separate lines. The existing
eval_base64 pattern only catches eval(base64_decode(...)) as a single
expression, and standalone base64_decode scores 5.0 (below the 6.0
threshold). Adding eval($variable) at risk 9.0 catches this evasion
technique.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The script was moved into the plugin folder but still used its own
directory as the working directory. Now it detects the WordPress root
via WP-CLI or by walking up the directory tree, so file paths like
wp-login.php and wp-content/plugins/ resolve correctly regardless of
where the script lives.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@pluginslab
Copy link
Copy Markdown
Owner

Closing this one. The simulate-hack.sh script and related additions were created for the hackathon demo. We are removing hackathon-specific test utilities from the codebase going forward. Thanks for the contribution during the hackathon!

@pluginslab pluginslab closed this Mar 27, 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.

2 participants