AppSec: query string arguments are added to ARGS_GET twice (&ARGS_GET:x is 2 for ?x=1)
Maintainers usually reply within 4 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- Half a day
- Newbie friendliness
- 60/100
Research direction
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.
Written by the indexing model from the issue text.
Description
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
- Dominant language
- Go
- Stars
- 15.1k
- Forks
- 726
- Avg merge
- 4d 23h
- Merged PRs (30d)
- 27
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from crowdsecurity/crowdsec
-
needs/kind needs/triage
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
crowdsecurity/crowdsec#4849 · 2 comments ·
Maintainers usually reply within 4 days
-
kind/bug needs/triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
crowdsecurity/crowdsec#4847 · 3 comments ·
Maintainers usually reply within 4 days
-
kind/bug needs/triage os/linux
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
crowdsecurity/crowdsec#4836 · 1 comment ·
Maintainers usually reply within 4 days
-
victorialogs datasource passes the trailing newline of a message to the parsers (traefik-logs 1.6 fails on every line)Possibly taken @IlayWolfson claimed this 6 days ago. Openkind/bug needs/triage os/linux version/1.8.2
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
crowdsecurity/crowdsec#4820 · 1 comment ·
Maintainers usually reply within 4 days
-
[email protected]Openneeds/kind needs/triage
Difficulty 5/5 Over a week Newbie friendliness 10/100
crowdsecurity/crowdsec#4842 · 3 comments ·
Maintainers usually reply within 4 days
All issues in crowdsecurity/crowdsec
Similar issues
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 62/100
DaoCloud/DaoCloud-docs#7839 ·
Maintainers usually reply within 1 day
-
Type: Enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
projectdiscovery/urlfinder#167 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
peterstace/simplefeatures#726 ·
-
area: import bug go good first issue priority: low
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
fukubie/StockLlama#69 ·
-
enhancement help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
cloverworks-hq/rumpty-cli#95 ·
Maintainers usually reply within 1 day