summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorViktor Szakats <commit@vsz.me>2021-02-23 14:54:46 +0100
committerDaniel Stenberg <daniel@haxx.se>2021-03-28 23:19:55 +0200
commit7214288898f5625a6cc196e22a74232eada7861c (patch)
tree3db8599cd34164f6005cb8aa423cb7cd9ddc853d /tests
parent184ffc0bdfcab17eb96d1dd64f9c0cecc139e3e9 (diff)
downloadcurl-7214288898f5625a6cc196e22a74232eada7861c.tar.gz
transfer: strip credentials from the auto-referer header field
Added test 2081 to verify. CVE-2021-22876 Bug: https://curl.se/docs/CVE-2021-22876.html
Diffstat (limited to 'tests')
-rw-r--r--tests/data/Makefile.inc2
-rw-r--r--tests/data/test208166
2 files changed, 67 insertions, 1 deletions
diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc
index 2c7a0ca89..ea52683d2 100644
--- a/tests/data/Makefile.inc
+++ b/tests/data/Makefile.inc
@@ -225,7 +225,7 @@ test2064 test2065 test2066 test2067 test2068 test2069 \
test2064 test2065 test2066 test2067 test2068 test2069 test2070 \
test2071 test2072 test2073 test2074 test2075 test2076 test2077 \
test2078 \
-test2080 \
+test2080 test2081 \
test2100 \
\
test3000 test3001 test3002 test3003 test3004 test3005 test3006 test3007 \
diff --git a/tests/data/test2081 b/tests/data/test2081
new file mode 100644
index 000000000..a6733e737
--- /dev/null
+++ b/tests/data/test2081
@@ -0,0 +1,66 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+referer
+followlocation
+--write-out
+</keywords>
+</info>
+
+# Server-side
+<reply>
+<data nocheck="yes">
+HTTP/1.1 301 This is a weirdo text message swsclose
+Location: data/%TESTNUMBER0002.txt?coolsite=yes
+Content-Length: 62
+Connection: close
+
+This server reply is for testing a simple Location: following
+</data>
+</reply>
+
+# Client-side
+<client>
+<server>
+http
+</server>
+ <name>
+Automatic referrer credential and anchor stripping check
+ </name>
+ <command>
+http://user:pass@%HOSTIP:%HTTPPORT/we/want/our/%TESTNUMBER#anchor --location --referer ';auto' --write-out '%{referer}\n'
+</command>
+</client>
+
+# Verify data after the test has been "shot"
+<verify>
+<errorcode>
+52
+</errorcode>
+<protocol>
+GET /we/want/our/%TESTNUMBER HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+Authorization: Basic dXNlcjpwYXNz
+User-Agent: curl/%VERSION
+Accept: */*
+
+GET /we/want/our/data/%TESTNUMBER0002.txt?coolsite=yes HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+Authorization: Basic dXNlcjpwYXNz
+User-Agent: curl/%VERSION
+Accept: */*
+Referer: http://%HOSTIP:%HTTPPORT/we/want/our/%TESTNUMBER
+
+</protocol>
+<stdout>
+HTTP/1.1 301 This is a weirdo text message swsclose
+Location: data/%TESTNUMBER0002.txt?coolsite=yes
+Content-Length: 62
+Connection: close
+
+http://%HOSTIP:%HTTPPORT/we/want/our/%TESTNUMBER
+</stdout>
+</verify>
+</testcase>