sigv4: URL encode the user name in the header

- split into sub functions
- add 'aws-sigv4' as keyword for many tests

Verify with test 3222

Reported-by: Trail of Bits
Closes #21923
This commit is contained in:
Daniel Stenberg 2026-06-09 11:40:41 +02:00
parent cb4b3e75e8
commit c7cba2fd2d
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
21 changed files with 349 additions and 159 deletions

View file

@ -281,7 +281,7 @@ test3100 test3101 test3102 test3103 test3104 test3105 test3106 \
\
test3200 test3201 test3202 test3203 test3204 test3205 test3206 test3207 \
test3208 test3209 test3210 test3211 test3212 test3213 test3214 test3215 \
test3216 test3217 test3218 test3219 test3220 test3221 \
test3216 test3217 test3218 test3219 test3220 test3221 test3222 \
\
test3300 test3301 test3302 test3303 test3304 test3305 \
\

View file

@ -4,6 +4,7 @@
<keywords>
HTTP
CURLOPT_AWS_SIGV4
aws-sigv4
</keywords>
</info>

View file

@ -4,6 +4,7 @@
<keywords>
HTTP
CURLOPT_AWS_SIGV4
aws-sigv4
</keywords>
</info>

View file

@ -4,6 +4,7 @@
<keywords>
HTTP
CURLOPT_AWS_SIGV4
aws-sigv4
</keywords>
</info>

View file

@ -4,6 +4,7 @@
<keywords>
HTTP
CURLOPT_AWS_SIGV4
aws-sigv4
</keywords>
</info>

View file

@ -5,6 +5,7 @@
HTTP
HTTP POST
CURLOPT_AWS_SIGV4
aws-sigv4
</keywords>
</info>

View file

@ -5,6 +5,7 @@
HTTP
HTTP POST
CURLOPT_AWS_SIGV4
aws-sigv4
</keywords>
</info>

View file

@ -4,6 +4,7 @@
<keywords>
HTTP
CURLOPT_AWS_SIGV4
aws-sigv4
</keywords>
</info>

View file

@ -4,6 +4,7 @@
<keywords>
HTTP
CURLOPT_AWS_SIGV4
aws-sigv4
</keywords>
</info>

View file

@ -4,6 +4,7 @@
<keywords>
HTTP
CURLOPT_AWS_SIGV4
aws-sigv4
</keywords>
</info>

View file

@ -4,6 +4,7 @@
<keywords>
HTTP
CURLOPT_AWS_SIGV4
aws-sigv4
</keywords>
</info>

View file

@ -4,6 +4,7 @@
<keywords>
HTTP
CURLOPT_AWS_SIGV4
aws-sigv4
</keywords>
</info>

View file

@ -4,6 +4,7 @@
<keywords>
HTTP
CURLOPT_AWS_SIGV4
aws-sigv4
</keywords>
</info>

View file

@ -4,6 +4,7 @@
<keywords>
HTTP
CURLOPT_AWS_SIGV4
aws-sigv4
</keywords>
</info>

View file

@ -4,6 +4,7 @@
<keywords>
HTTP
CURLOPT_AWS_SIGV4
aws-sigv4
</keywords>
</info>

View file

@ -4,6 +4,7 @@
<keywords>
HTTP
CURLOPT_AWS_SIGV4
aws-sigv4
</keywords>
</info>

View file

@ -4,6 +4,7 @@
<keywords>
HTTP
CURLOPT_AWS_SIGV4
aws-sigv4
</keywords>
</info>

View file

@ -4,6 +4,7 @@
<keywords>
HTTP
CURLOPT_AWS_SIGV4
aws-sigv4
</keywords>
</info>

View file

@ -4,6 +4,7 @@
<keywords>
HTTP
CURLOPT_AWS_SIGV4
aws-sigv4
</keywords>
</info>

57
tests/data/test3222 Normal file
View file

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="US-ASCII"?>
<testcase>
<info>
<keywords>
HTTP
aws-sigv4
</keywords>
</info>
# Server-side
<reply>
<data crlf="headers">
HTTP/1.1 200 OK
Date: Tue, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
ETag: "21025-dc7-39462498"
Accept-Ranges: bytes
Content-Length: 6
Connection: close
Content-Type: text/html
Funny-head: yesyes
-foo-
</data>
</reply>
# Client-side
<client>
<server>
http
</server>
<features>
Debug
aws
</features>
<name>
aws-sigv4 with CRLF in username
</name>
<command>
"http://user%0d%0a:secret@fake.fake.fake:8000/" --aws-sigv4 "aws:amz:us-east-2:es" --connect-to fake.fake.fake:8000:%HOSTIP:%HTTPPORT
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<protocol crlf="headers">
GET / HTTP/1.1
Host: fake.fake.fake:8000
Authorization: AWS4-HMAC-SHA256 Credential=user%0D%0A/19700101/us-east-2/es/aws4_request, SignedHeaders=host;x-amz-date, Signature=e5747e9555c0e96f1067cc4bf9f6055e72a185178e5dd0c2909279ec1d66360b
X-Amz-Date: 19700101T000000Z
User-Agent: curl/%VERSION
Accept: */*
</protocol>
</verify>
</testcase>