Transfer-Encoding and Connection response headers seen by the rules don't match the chunked filter's
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 22/100
Direzione di ricerca
The bug is in the connector's response-header resolvers for Transfer-Encoding and Connection, which read r->chunked and r->keepalive before nginx's chunked filter has run. Start with those resolvers, then reproduce with the ssi on config in the issue and curl -i to see the headers the rule receives. Done means RESPONSE_HEADERS:Transfer-Encoding matches chunked output, Connection reflects close, and the reproduction returns 403. PR #421 is already open against this issue, so check it before starting.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The response headers handed to the rules in phase 3 don't match what nginx sends when the body is chunked, or when nginx closes the connection because it can't chunk.
nginx's chunked filter runs after the connector's header filter. The Transfer-Encoding resolver checks r->chunked, which that filter hasn't set yet, so it's always 0. The Connection resolver checks r->keepalive, which the chunked filter may still clear. As a result:
Transfer-Encoding: chunkedis never seen. A response of unknown length over HTTP/1.1 is sent chunked, butRESPONSE_HEADERS:Transfer-Encodingis never set.Connection: keep-aliveis seen when nginx sendsConnection: close. This happens when nginx can't chunk a response of unknown length: an HTTP/1.0 keep-alive request, orchunked_transfer_encoding off. nginx then clearsr->keepalive.- Trailers: with
add_trailer, nginx chunks the response and dropsContent-Length. The rules seeContent-Lengthand noTransfer-Encoding.
To reproduce
ssi on clears the length of a static file before the connector runs:
location / {
ssi on;
modsecurity on;
modsecurity_rules '
SecRuleEngine On
SecRule RESPONSE_HEADERS:Transfer-Encoding "@streq chunked" "id:1,phase:3,deny,status:403"
';
}
curl -i http://localhost/index.html returns 200 with Transfer-Encoding: chunked. The rule should have matched and returned 403.
Not covered
gzip also runs after the connector and can drop a known Content-Length. Predicting that would mean copying gzip's own checks (Accept-Encoding, gzip_types, gzip_min_length, ...), so that case isn't covered here.
- Lingua principale
- Perl
- Stelle
- 1.9k
- Fork
- 312
- Merge medio
- 2g 22h
- PR unite (30g)
- 4
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di owasp-modsecurity/ModSecurity-nginx
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
owasp-modsecurity/ModSecurity-nginx#418 ·
I maintainer di solito rispondono entro 1 giorno
-
Possible dereference of NullAperta:1st_place_medal: good first issue enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
owasp-modsecurity/ModSecurity-nginx#359 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Relative Location response header is seen by the rules, nginx sends it absoluteForse già presa @fzipi l’ha presa oggi. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
owasp-modsecurity/ModSecurity-nginx#422 ·
I maintainer di solito rispondono entro 1 giorno
-
Documentation: Clarify dynamic module ABI compatibility with distribution-patched NGINX packagesForse già presa @airween l’ha presa oggi. Apertaenhancement
owasp-modsecurity/ModSecurity-nginx#419 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Connection response header is seen by the rules on HTTP/2 responsesForse già presa @fzipi l’ha presa oggi. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 25/100
owasp-modsecurity/ModSecurity-nginx#415 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di owasp-modsecurity/ModSecurity-nginx
Issue simili
-
fix(rodex): sent mail loses the last character of title and bodyForse già presa @baphomello l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
inverse-inc/packetfence#9768 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
metacpan/metacpan-api#1534 ·