Skip to content

PR: Honeytrap header injection fix and rules testable#41

Open
Divyateja2709 wants to merge 20 commits intoOWASP:masterfrom
Divyateja2709:ci/add-update-off-integration-test
Open

PR: Honeytrap header injection fix and rules testable#41
Divyateja2709 wants to merge 20 commits intoOWASP:masterfrom
Divyateja2709:ci/add-update-off-integration-test

Conversation

@Divyateja2709
Copy link
Copy Markdown

Hi @adrianwinckles,

This PR fixes the place response headers are set (Apache vs ModSecurity), removes rule-order conflicts, and provides deterministic honeytrap behaviour for reliable integration tests in future PRs.
What I changed

Moved Apache Header directives into httpd.conf (within ), ensuring Apache sets response headers.
Removed Apache Header ... Directives from ModSecurity configs (e.g. Modsecurity-extension.conf), and only define response headers as SecRule/SecAction directives for ModSecurity.
Made the target, /dbbackup.<10 digits> deterministic - all rules consolidated and will always yield 401 with basicauth without being short-circuited earlier through phase/order mechanics.
Scoped the bait cookie name by IP address instead of making it global, preventing clients overwriting other's state via ip.* directives.
Improved way we capture the Set-Cookie name from responses to correctly infer the bait cookie name.

Why I changed it

Apache headers should be processed by Apache itself. Define them in httpd.conf instead of ModSecurity config (they will cause startup errors, or simply be ignored silently if added elsewhere).
Consolidating the rules to a single rule preventing phase and order conflicts, allowing env-var handoff (setenv:basicauth, setenv:HONEYTRAPCOOKIE_NAME) to reliably instruct Apache to add the headers.
Using ip.* directives prevents state from being corrupted between multiple clients.
Tests (planned)

Integration test for /db_backup., which checks response status is 401 and includesWWW-Authenticate header (verifying Apache env-var injection is effective).
Integration test to verify that setting of bait cookie is followed by blocking a modified bait cookie on a subsequent request.
Regression test to demonstrate no interference between multiple client state (ip.* scoping).

Why I'm adding tests
The behavior of these honeypot requests are inherently vulnerable to rule-order and phase, env-var handoff, and scope issues. Making these aspects deterministic allow for stable automated testing of the flow.

I'm working on the tests and will be adding them in the next pr

Added optional CRS update logic and improved logging for background processes.
Added initial README.md for CRS Auto Update script with planned features and assumptions.
Removed comment about Sidekick code generation.
Added logging and process management for Apache and Filebeat.
Updated the script to enforce SHA256 checksum format and added timeout options for curl and wget commands.
Updated filebeat configuration path to absolute path.
Updated Dockerfile to include TARGETARCH argument and modified file paths.
Added headers to prevent HTTP_PROXY leakage and set authentication headers.
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