]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
socks: Make SafeSocks refuse SOCKS4 and accept SOCKS4a
authorDavid Goulet <dgoulet@torproject.org>
Mon, 12 Dec 2022 15:02:07 +0000 (10:02 -0500)
committerDavid Goulet <dgoulet@torproject.org>
Mon, 12 Dec 2022 15:02:07 +0000 (10:02 -0500)
The logic was inverted. Introduced in commit
9155e08450fe7a609f8223202e8aa7dfbca20a6d.

This was reported through our bug bounty program on H1. It fixes the
TROVE-2022-002.

Fixes #40730

Signed-off-by: David Goulet <dgoulet@torproject.org>
changes/ticket40730 [new file with mode: 0644]
src/core/proto/proto_socks.c

diff --git a/changes/ticket40730 b/changes/ticket40730
new file mode 100644 (file)
index 0000000..f6d4c9d
--- /dev/null
@@ -0,0 +1,5 @@
+  o Major bugfixes (TROVE-2022-002, client):
+    - The SafeSocks option had its logic inverted for SOCKS4 and SOCKS4a. It
+      would let the unsafe SOCKS4 pass but not the safe SOCKS4a one. This is
+      TROVE-2022-002 which was reported on Hackerone by "cojabo". Fixes bug
+      40730; bugfix on 0.3.5.1-alpha.
index a7ee190b3f294d6d7f0f1fc2511269f26879dc15..97863d389ea0a6b1f07e2fa1b7923713a570d0a2 100644 (file)
@@ -233,7 +233,7 @@ static socks_result_t
 process_socks4_request(const socks_request_t *req, int is_socks4a,
                        int log_sockstype, int safe_socks)
 {
-  if (is_socks4a && !addressmap_have_mapping(req->address, 0)) {
+  if (!is_socks4a && !addressmap_have_mapping(req->address, 0)) {
     log_unsafe_socks_warning(4, req->address, req->port, safe_socks);
 
     if (safe_socks)