Skip to content

AppSec: query string arguments are added to ARGS_GET twice (&ARGS_GET:x is 2 for ?x=1) #4812

Open

Description

@infotrend

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 by SecRule &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 through seclang_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):

  1. The runner adds request.Args with AddGetRequestArgument. NewParsedRequestFromRequest parsed those arguments from the query string.
  2. It then calls ProcessURI with the same URI.
  3. Coraza's ProcessURI extracts 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

Activity

  1. github-actions commented on Nov 10, 2026

    @github-actions

    @infotrend: Thanks for opening an issue, it is currently awaiting triage.

    In the meantime, you can:

    1. Check Crowdsec Documentation to see if your issue can be self resolved.
    2. You can also join our Discord.
    3. Check Releases to make sure your agent is on the latest version.
    Details

    I am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository.

  2. github-actions commented on Nov 10, 2026

    @github-actions

    @infotrend: There are no 'kind' label on this issue. You need a 'kind' label to start the triage process.

    • /kind feature
    • /kind enhancement
    • /kind refactoring
    • /kind bug
    • /kind packaging
    Details

    I am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository.

  3. infotrend commented on Nov 10, 2026

    @infotrend
    Author

    /kind bug

  4. added
    kind/bug
    and removed on Nov 10, 2026
  5. hmjgriffon1 commented on Dec 5, 2026

    @hmjgriffon1

    I'd like to confirm that I'm also experiencing this issue with CrowdSec v1.8.2-3d369d64 running as a Home Assistant add-on behind NPMplus.

    While testing OWASP CRS PL3 enforcement, the Home Assistant Companion app for iOS triggered rule 921180 (HTTP Parameter Pollution) on the following legitimate request:

    /?external_auth=1

    The parameter appears only once in the request URI, but AppSec reports parameter pollution, contributing 5 anomaly points and reaching the default blocking threshold.

    I have also encountered difficulties with narrowly scoped CRS exclusions that rely on query argument counts, which appear consistent with the duplicate argument behavior described in this issue.

    PL2 enforcement otherwise works well in my environment. Unfortunately, this issue is currently preventing me from moving to PL3 without introducing additional exclusions that I'd prefer to avoid.

    I'd be happy to test a patched release in my Home Assistant environment and provide feedback.

    Thank you for your work on CrowdSec!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugneeds/triageversion/1.8.2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions