Nettacker icon indicating copy to clipboard operation
Nettacker copied to clipboard

http_cookie_vuln misses later Set-Cookie headers, making detection depend on header order

Open euvoor opened this issue 3 weeks ago • 1 comments

I found a false negative in http_cookie_vuln: when a response includes multiple Set-Cookie headers, only the first reaches the condition matcher.

For example, a local server returns:

Set-Cookie: session=fixture; SameSite=Lax; secure; HttpOnly; Max-Age=3600
Set-Cookie: preferences=fixture

The second cookie lacks the attributes this module checks, but Nettacker produces no finding. Reversing the two headers produces a finding, without changing either cookie.

Reproduction

Tested on master at c7ecc2c8cd40ff6ca586d5d22929516a3fd44954, using Python 3.11.18, a local HTTP fixture and the default APSW database.

Run against the fixture’s port:

python nettacker.py -i 127.0.0.1 -m http_cookie_vuln \
  -d -g PORT --schema http -o report.json

Each scenario used a separate working directory and database:

Response headers Expected findings Actual findings
Fully attributed cookie alone 0 0
Cookie missing attributes alone 1 1
Fully attributed cookie, then cookie missing attributes 1 0
Same cookies in reverse order 1 1

Each scan sent one HTTP request and exited successfully. The actual counts above were checked directly in scan_events.

Root cause

perform_request_action() converts the response headers into a plain dictionary:

"headers": dict(response.headers),

The HTTP client receives both Set-Cookie values, but this conversion retains only the first. The later value is lost before response_conditions_matched() evaluates the module’s rule.

Expected behavior

The cookie check should inspect every Set-Cookie value. Reordering identical headers should not change whether the missing attributes are detected.

The fix needs to preserve repeated header values through response normalization and evaluate cookies individually. Regression coverage should include both header orders and the single-cookie controls above.

I checked related issues and PRs and didn’t find this specific failure reported. I’m happy to work on a focused fix once the approach is reviewed and the issue is assigned.

euvoor avatar Nov 12 '26 10:11 euvoor

Hi! I'm interested in contributing to Nettacker and have been exploring this issue.

I noticed the original reporter is also interested in implementing the fix. Would it be possible for me to help with regression tests or another part of the solution?

I'd be happy to follow the maintainers' guidance. Thanks!

Nirod2004 avatar Nov 14 '26 11:11 Nirod2004