summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYogita Urade <yogita.urade@windriver.com>2025-07-08 14:27:29 +0530
committerSteve Sakoman <steve@sakoman.com>2025-07-14 08:37:40 -0700
commit022d6ec767487a52fc479e25ebad11012df01474 (patch)
tree56bbed17d31fd653077c779e1e73a360b13395d2
parent580a1571c4bc7341bd19b067b9e5a8bc4194b627 (diff)
downloadpoky-022d6ec767487a52fc479e25ebad11012df01474.tar.gz
curl: fix CVE-2025-0167
When asked to use a `.netrc` file for credentials *and* to follow HTTP redirects, curl could leak the password used for the first host to the followed-to host under certain circumstances. This flaw only manifests itself if the netrc file has a `default` entry that omits both login and password. A rare circumstance. Reference: https://nvd.nist.gov/vuln/detail/CVE-2025-0167 Upstream patch: https://github.com/curl/curl/commit/0e120c5b925e8ca75d5319e319e5ce4b8080d8eb (From OE-Core rev: 7c5aee3066e4c8056d994cd50b26c18a16316c96) Signed-off-by: Yogita Urade <yogita.urade@windriver.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r--meta/recipes-support/curl/curl/CVE-2025-0167.patch175
-rw-r--r--meta/recipes-support/curl/curl_7.82.0.bb1
2 files changed, 176 insertions, 0 deletions
diff --git a/meta/recipes-support/curl/curl/CVE-2025-0167.patch b/meta/recipes-support/curl/curl/CVE-2025-0167.patch
new file mode 100644
index 0000000000..b803cff0d2
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2025-0167.patch
@@ -0,0 +1,175 @@
1From 0e120c5b925e8ca75d5319e319e5ce4b8080d8eb Mon Sep 17 00:00:00 2001
2From: Daniel Stenberg <daniel@haxx.se>
3Date: Fri, 3 Jan 2025 16:22:27 +0100
4Subject: [PATCH] netrc: 'default' with no credentials is not a match
5
6Test 486 verifies.
7
8Reported-by: Yihang Zhou
9
10Closes #15908
11
12Changes:
13- Test files are added in Makefile.inc.
14- Adjust `%LOGDIR/` to 'log/' due to its absence in code.
15
16CVE: CVE-2025-0167
17Upstream-Status: Backport [https://github.com/curl/curl/commit/0e120c5b925e8ca75d5319e319e5ce4b8080d8eb]
18
19Signed-off-by: Yogita Urade <yogita.urade@windriver.com>
20---
21 lib/netrc.c | 7 ++-
22 tests/data/Makefile.in | 2 +
23 tests/data/test486 | 105 +++++++++++++++++++++++++++++++++++++++++
24 3 files changed, 113 insertions(+), 1 deletion(-)
25 create mode 100644 tests/data/test486
26
27diff --git a/lib/netrc.c b/lib/netrc.c
28index 23080b3..6d87007 100644
29--- a/lib/netrc.c
30+++ b/lib/netrc.c
31@@ -205,12 +205,17 @@ static int parsenetrc(const char *host,
32 } /* while fgets() */
33
34 out:
35- if(!retcode && !password && our_login) {
36+ if(!retcode) {
37+ if(!password && our_login) {
38 /* success without a password, set a blank one */
39 password = strdup("");
40 if(!password)
41 retcode = 1; /* out of memory */
42 }
43+ else if(!login && !password)
44+ /* a default with no credentials */
45+ retcode = NETRC_FILE_MISSING;
46+ }
47 if(!retcode) {
48 /* success */
49 *login_changed = FALSE;
50diff --git a/tests/data/Makefile.in b/tests/data/Makefile.in
51index 3da7d31..5a3ec48 100644
52--- a/tests/data/Makefile.in
53+++ b/tests/data/Makefile.in
54@@ -431,6 +431,8 @@ test409 test410 \
55 \
56 test430 test431 test432 test433 test434 test435 test436 \
57 \
58+test486 \
59+\
60 test490 test491 test492 test493 test494 \
61 \
62 test500 test501 test502 test503 test504 test505 test506 test507 test508 \
63diff --git a/tests/data/test486 b/tests/data/test486
64new file mode 100644
65index 0000000..6926092
66--- /dev/null
67+++ b/tests/data/test486
68@@ -0,0 +1,105 @@
69+<testcase>
70+<info>
71+<keywords>
72+netrc
73+HTTP
74+</keywords>
75+</info>
76+#
77+# Server-side
78+<reply>
79+<data crlf="yes">
80+HTTP/1.1 301 Follow this you fool
81+Date: Tue, 09 Nov 2010 14:49:00 GMT
82+Server: test-server/fake
83+Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
84+ETag: "21025-dc7-39462498"
85+Accept-Ranges: bytes
86+Content-Length: 6
87+Connection: close
88+Location: http://b.com/%TESTNUMBER0002
89+
90+-foo-
91+</data>
92+
93+<data2 crlf="yes">
94+HTTP/1.1 200 OK
95+Date: Tue, 09 Nov 2010 14:49:00 GMT
96+Server: test-server/fake
97+Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
98+ETag: "21025-dc7-39462498"
99+Accept-Ranges: bytes
100+Content-Length: 7
101+Connection: close
102+
103+target
104+</data2>
105+
106+<datacheck crlf="yes">
107+HTTP/1.1 301 Follow this you fool
108+Date: Tue, 09 Nov 2010 14:49:00 GMT
109+Server: test-server/fake
110+Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
111+ETag: "21025-dc7-39462498"
112+Accept-Ranges: bytes
113+Content-Length: 6
114+Connection: close
115+Location: http://b.com/%TESTNUMBER0002
116+
117+HTTP/1.1 200 OK
118+Date: Tue, 09 Nov 2010 14:49:00 GMT
119+Server: test-server/fake
120+Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
121+ETag: "21025-dc7-39462498"
122+Accept-Ranges: bytes
123+Content-Length: 7
124+Connection: close
125+
126+target
127+</datacheck>
128+</reply>
129+
130+#
131+# Client-side
132+<client>
133+<server>
134+http
135+</server>
136+<features>
137+proxy
138+</features>
139+<name>
140+.netrc with redirect and "default" with no password or login
141+</name>
142+<command>
143+--netrc --netrc-file log/netrc%TESTNUMBER -L -x http://%HOSTIP:%HTTPPORT/ http://a.com/
144+</command>
145+<file name="log/netrc%TESTNUMBER" >
146+
147+machine a.com
148+ login alice
149+ password alicespassword
150+
151+default
152+
153+</file>
154+</client>
155+
156+<verify>
157+<protocol>
158+GET http://a.com/ HTTP/1.1
159+Host: a.com
160+Authorization: Basic %b64[alice:alicespassword]b64%
161+User-Agent: curl/%VERSION
162+Accept: */*
163+Proxy-Connection: Keep-Alive
164+
165+GET http://b.com/%TESTNUMBER0002 HTTP/1.1
166+Host: b.com
167+User-Agent: curl/%VERSION
168+Accept: */*
169+Proxy-Connection: Keep-Alive
170+
171+</protocol>
172+</verify>
173+</testcase>
174--
1752.40.0
diff --git a/meta/recipes-support/curl/curl_7.82.0.bb b/meta/recipes-support/curl/curl_7.82.0.bb
index f40139418a..623d8a4bc3 100644
--- a/meta/recipes-support/curl/curl_7.82.0.bb
+++ b/meta/recipes-support/curl/curl_7.82.0.bb
@@ -65,6 +65,7 @@ SRC_URI = "https://curl.se/download/${BP}.tar.xz \
65 file://CVE-2024-9681.patch \ 65 file://CVE-2024-9681.patch \
66 file://CVE-2024-11053-0001.patch \ 66 file://CVE-2024-11053-0001.patch \
67 file://CVE-2024-11053-0002.patch \ 67 file://CVE-2024-11053-0002.patch \
68 file://CVE-2025-0167.patch \
68 " 69 "
69SRC_URI[sha256sum] = "0aaa12d7bd04b0966254f2703ce80dd5c38dbbd76af0297d3d690cdce58a583c" 70SRC_URI[sha256sum] = "0aaa12d7bd04b0966254f2703ce80dd5c38dbbd76af0297d3d690cdce58a583c"
70 71