AppSec: query string arguments are added to ARGS_GET twice (&ARGS_GET:x is 2 for ?x=1)
I maintainer di solito rispondono entro 4 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- Mezza giornata
- Idoneità per principianti
- 60/100
Direzione di ricerca
Start in pkg/acquisition/modules/appsec/appsec_runner.go around lines 206-212, where request.Args is added with AddGetRequestArgument before ProcessURI is called with the same URI. Confirm that ProcessURI already fills ARGS_GET from the query string, then check that removing the loop leaves body arguments unaffected. Done when /?foo=1 gives &ARGS_GET:foo = 1 in a test, the reproduction in the issue returns 200, 403, 200, and the existing appsec tests still pass.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What happened?
In AppSec, every argument of the query string appears twice in ARGS_GET, and so also in ARGS, ARGS_GET_NAMES and ARGS_NAMES. For a request to /?foo=1, &ARGS_GET:foo is 2. For /?foo=1&foo=2 it is 4.
This has two consequences:
- A rule that counts a query argument never matches as written. The CRS WordPress rule-exclusion plugin is one example. Its exclusions for the REST API called as
/index.php?rest_route=…are guarded bySecRule &ARGS:rest_route "@eq 1", and that guard never holds under AppSec. On a WordPress site with plain permalinks (WordPress's default), saving a post that contains code is then blocked with a 403, even though the plugin is on. We measured this with CRS 4.25 LTS and the plugin 1.2.0, loaded throughseclang_files_rules. - A rule that counts how often a parameter name appears sees every query parameter twice. The pattern of CRS rules 921170/921180 (HTTP parameter pollution, paranoia level 3) blocks a request that has a single query parameter. See the reproduction below.
The cause is in pkg/acquisition/modules/appsec/appsec_runner.go, lines 206-212 (v1.8.2, unchanged on master):
- The runner adds
request.ArgswithAddGetRequestArgument.NewParsedRequestFromRequestparsed those arguments from the query string. - It then calls
ProcessURIwith the same URI. - Coraza's
ProcessURIextracts the GET arguments from the query string again (tx.ExtractGetArguments(parsedURL.RawQuery)).
for k, v := range request.Args {
for _, vv := range v {
state.Tx.AddGetRequestArgument(k, vv)
}
}
state.Tx.ProcessURI(request.URI, request.Method, request.Proto)
What did you expect to happen?
One query argument counts once, as in ModSecurity and in Coraza used on its own: &ARGS_GET:foo is 1 for /?foo=1.
How can we reproduce it (as minimally and precisely as possible)?
Use the official image crowdsecurity/crowdsec:v1.8.2 with these three files.
/etc/crowdsec/appsec-rules/args-count.yaml:
name: repro/args-count
seclang_rules:
- SecRule &ARGS_GET:foo "@eq 2" "id:1999001,phase:1,deny,status:403,log,msg:'ARGS_GET:foo counted twice'"
- SecRule &ARGS_GET:bar "@eq 1" "id:1999002,phase:1,deny,status:403,log,msg:'ARGS_GET:bar counted once'"
- SecRule ARGS_GET_NAMES "@rx ^baz$" "id:1999003,phase:1,pass,nolog,setvar:'tx.paramcounter_%{MATCHED_VAR_NAME}=+1'"
- SecRule TX:/paramcounter_.*/ "@gt 1" "id:1999004,phase:1,deny,status:403,log,msg:'parameter seen more than once (%{MATCHED_VAR_NAME})'"
/etc/crowdsec/appsec-configs/args-count.yaml:
name: repro/args-count
default_remediation: ban
inband_rules:
- repro/args-count
/etc/crowdsec/acquis.d/appsec.yaml:
source: appsec
listen_addr: 0.0.0.0:7422
appsec_configs:
- repro/args-count
routines: 1
labels:
type: appsec
Start the container with BOUNCER_KEY_repro=<key> and the three files mounted. For a throwaway container we also set DISABLE_ONLINE_API=true and CROWDSEC_BYPASS_DB_VOLUME_CHECK=true. Then send these requests to AppSec:
ask() {
curl -s -o /dev/null -w '%{http_code}\n' -H "X-Crowdsec-Appsec-Api-Key: $KEY" -H 'X-Crowdsec-Appsec-Ip: 192.0.2.10' \
-H "X-Crowdsec-Appsec-Uri: $1" -H 'X-Crowdsec-Appsec-Host: example.test' -H 'X-Crowdsec-Appsec-Verb: GET' http://127.0.0.1:7422/
}
ask '/?foo=1' # 403: &ARGS_GET:foo is 2
ask '/?bar=1' # 200: &ARGS_GET:bar "@eq 1" never matches
ask '/?baz=1' # 403: "parameter seen more than once (TX:paramcounter_args_get_names:baz)"
The log shows WAF block: ARGS_GET:foo counted twice and WAF block: parameter seen more than once (TX:paramcounter_args_get_names:baz). The expected answers are the other way round: 200, 403, 200.
Anything else we need to know?
Removing the AddGetRequestArgument loop should fix it, since ProcessURI already fills ARGS_GET from the same query string.
Arguments in a urlencoded body are not affected: we measured &ARGS_POST:x as 1 for one body argument.
Crowdsec version
version: v1.8.2-3d369d64
Codename: alphaga
BuildDate: 2026-10-29_09:53:07
GoVersion: 1.27.3
Platform: docker
We first saw it with the official 1.8.2 Debian package on Debian 13, with AppSec behind nginx.
OS version
Official Docker image, on a Debian 13 host.
Enabled collections and parsers
The image's defaults. Only the AppSec configuration above takes part in the test.
Acquisition config
See above.
/kind bug
- Lingua principale
- Go
- Stelle
- 15.1k
- Fork
- 726
- Merge medio
- 4g 23h
- PR unite (30g)
- 27
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
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 crowdsecurity/crowdsec
-
needs/kind needs/triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
crowdsecurity/crowdsec#4849 · 2 commenti ·
I maintainer di solito rispondono entro 4 giorni
-
kind/bug needs/triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
crowdsecurity/crowdsec#4847 · 3 commenti ·
I maintainer di solito rispondono entro 4 giorni
-
kind/bug needs/triage os/linux
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
crowdsecurity/crowdsec#4836 · 1 commento ·
I maintainer di solito rispondono entro 4 giorni
-
victorialogs datasource passes the trailing newline of a message to the parsers (traefik-logs 1.6 fails on every line)Forse già presa @IlayWolfson l’ha presa 6 giorni fa. Apertakind/bug needs/triage os/linux version/1.8.2
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
crowdsecurity/crowdsec#4820 · 1 commento ·
I maintainer di solito rispondono entro 4 giorni
-
[email protected]Apertaneeds/kind needs/triage
Difficoltà 5/5 Più di una settimana Idoneità per principianti 10/100
crowdsecurity/crowdsec#4842 · 3 commenti ·
I maintainer di solito rispondono entro 4 giorni
Tutte le issue di crowdsecurity/crowdsec
Issue simili
-
【文档错误】创建镜像空间步骤中的截图标注与文字描述不一致Apertaenhancement
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 62/100
DaoCloud/DaoCloud-docs#7839 ·
I maintainer di solito rispondono entro 1 giorno
-
Type: Enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
projectdiscovery/urlfinder#167 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
peterstace/simplefeatures#726 ·
-
area: import bug go good first issue priority: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
fukubie/StockLlama#69 ·
-
enhancement help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
cloverworks-hq/rumpty-cli#95 ·
I maintainer di solito rispondono entro 1 giorno