Query: percent-decoded NUL silently truncates parameter names and values
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- c
- Domain
- backend-api-design, security
Research direction
Start with src/net/http/query.c, especially url_decode() and cwist_query_map_parse() around the linked lines. Trace how query names and values are decoded and how duplicate keys are handled, then add coverage for encoded NUL in both positions and duplicate-key handling. Done means decoded NULs produce HTTP 400 without silently truncating query data.
Written by the indexing model from the issue text.
Description
Confirmed on dev at fd8cf045770459ebc0f6b6740f54dcd30a80ce6c.
url_decode() accepts %00 and writes the decoded NUL into a C string. All subsequent map operations then treat that byte as the end of the key or value, silently truncating attacker-controlled input.
Reproduction:
cwist_query_map_parse(map, "role=user%00admin&next=ok");
role=user next=ok
The raw query still contains role=user%00admin, while the application map sees role=user. WAF rules, signatures, authorization checks, and application handlers can therefore make different security decisions on the same request.
Reject decoded NUL bytes in query names and values with HTTP 400 rather than silently truncating them. Add coverage for encoded NUL in both positions and for duplicate-key handling.
- Dominant language
- C
- Stars
- 16
- Forks
- 7
- Avg merge
- 4h 54m
- Merged PRs (30d)
- 185
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
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 c4punks/CWIST
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
bug
Difficulty 4/5 1-2 days Newbie friendliness 58/100
Maintainers usually reply within 1 day
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 53/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
libretro/parallel-n64#858 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Mbed-TLS/TF-PSA-Crypto#984 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
tursodatabase/libsql#2320 ·
Maintainers usually reply within 11 days
-
type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day