From 7da58510d002e5e3f6e5515197059b0daa4fe3d7 Mon Sep 17 00:00:00 2001 From: Vladimir Dubrovin <3proxy@3proxy.ru> Date: Sat, 21 Nov 2026 12:08:39 +0300 Subject: [PATCH] Commit as 1.0.4 --- CHANGELOG | 24 ++++++++++++------------ CHANGELOG.rus | 24 ++++++++++++------------ RELEASE | 2 +- doc/changelog/1/0/4 | 11 +++++++++++ 4 files changed, 36 insertions(+), 25 deletions(-) create mode 100644 doc/changelog/1/0/4 diff --git a/CHANGELOG b/CHANGELOG index 282e0e2..0ed1896 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,13 +1,13 @@ -3proxy-1.0.3 Released November, 7 2026 +3proxy-1.0.4 Released November, 21 2026 -! Fix: RADIUS authentication: the reply digest copied the shared secret right after the received bytes, so a reply of 4100 bytes with a secret of 17 or more characters wrote up to 47 bytes of it past the reply buffer on the stack, before the reply was authenticated; the digest is hashed over the reply and the secret in place now, with nothing written past the reply, and a reply is taken only from the address and port of the server the request went to, with the request's identifier and length, which was never checked before -! Fix: the PTR answer of a name server could write past the answer buffer on the stack: the label walk ran to the end of the whole message instead of the end of the record's data and could take a compression pointer for a label length (an answer of 3841 bytes or more reached past the buffer itself); the walk now stops at the end of the record's data, and a compressed, empty or truncated name is not accepted -! Fix: every connection matching a pcre: (or regex:) rule matched on the one match data block of the rule, which pcre2_match() writes into: two connections matching at the same time raced and corrupted memory, bringing the process down under load; a connection now makes a match data block of its own -! Fix: TLS: a read which could only be done once a write was, or a write once a read was (a TLS 1.3 key update answered while the socket cannot take more, for example), ended the connection with an error; each TLS socket remembers now what its pending read and write wait for, and the poll of the TLS layer waits for that -! Fix: Windows: a TLS read or write which wanted the socket again was not seen as one and dropped the connection with an unrelated error: the C library's errno was set where the socket error is read -! Fix: a client of a connect back (-R) service stayed in accept() for the connection another client of the same service took, until the next one came, past its time out and through a configuration reload; the connect back socket is non-blocking now, and an accept() with nothing to take does not count as one of the client's tries -! Fix: ftppr: the answer of a server which logs in on USER alone (230, as anonymous FTP often does) or refuses the login was read but never handed to the client, which was left waiting for the answer to its PASS until the time out (#1284) -! Fix: plugins: StringsPlugin, cutting a string table line at its end, wrote NULs past the line, into what the buffer kept of longer lines read before or past its end; FilePlugin passed the TLS state of the connection where the client's parameters were expected, so sending a string table over a TLS connection read a TLS state as a clientparam -+ -B (for TCP services) splits the TLS ClientHello passed through tlspr in the middle of the server name (SNI), so DPI systems which do not reassemble it do not see the host name; TCP_NODELAY, set by default, must not be turned off, or the kernel may join the segments again; -s keeps the same effect where -s is not splice (#1283) -+ 3proxy --help (and the usage message of a bad invocation) lists what the build was made with: TLS and its backend, RADIUS, PCRE, IPv6, UNIX sockets, the built-in HTTP server, transparency, ODBC and the optional proxy services -+ An outgoing connection bound to an external address is bound with IP_BIND_ADDRESS_NO_PORT on Linux 4.2 and later: the port is chosen by connect() for the pair with the destination, so ports in use towards other destinations or closing in TIME_WAIT do not run the ephemeral range out; bind() no longer failed with result 12 or searched long for a port under many connections +! Fix: socks: a SOCKS4a request was refused as a connect to the null address, although in SOCKS4a the null address means that the destination is the name which follows it +! Fix: auth: a UDP ASSOCIATE is pre-authorized without looking at the destination its rules depend on, so its verdict holds for that association alone and is not kept for later requests +! Fix: socks: a UDP association was relayed direct when its parent failed, although the rules demanded the parent; it is refused now +! Fix: socks: a host name with control bytes or spaces in it was taken as it stood; it is refused where it is read now +! Fix: smtpp: a login name of a port alone, without a host, set the port but named no destination to connect to; such a login is refused now +! Fix: proxy: the credentials of an earlier request on a kept-alive connection decided for the requests after it; every request is authorized by its own credentials now +! Fix: the built-in http server (httpsrv): the credentials of an earlier request on a kept-alive connection decided for the requests after it; every request is authorized by its own credentials now +! Fix: tlspr: a TLS ServerHello too short for the extensions length it declared was read past its end; it is refused now (#1286) +! Fix: httpsrv: a request which a limit of the service exceeded was answered anyway, the 503 every other service answers with taken for success; it is answered with 503 now, after the body of the request is drained +! Fix: httpsrv: a path ending in a backslashed dot-dot, or carrying one in a form the checks did not name, was taken as it stood; any dot-dot segment is refused wherever it is and whichever separator carries it, and a path ending in a bare dot of either kind +! Fix: pcre: a rule with no ACL was handed to the filters as the connection's data, which they read as a match data block and freed: a pointer into the configuration, dereferenced as another type and given back to malloc; a rule without an ACL now skips the check and goes on with a block of its own diff --git a/CHANGELOG.rus b/CHANGELOG.rus index 4766f19..d804ca7 100644 --- a/CHANGELOG.rus +++ b/CHANGELOG.rus @@ -1,13 +1,13 @@ -3proxy-1.0.3 Вышел 7 Ноября 2026 +3proxy-1.0.4 Вышел 21 Ноября 2026 -! Исправление: аутентификация RADIUS: дайджест ответа копировал общий секрет сразу за принятыми байтами, так что ответ размером 4100 байт с секретом в 17 и более символов записывал до 47 байт секрета за буфер ответа на стеке, ещё до проверки подлинности ответа; дайджест теперь вычисляется по ответу и секрету на месте, ничего не записывая за буфер, а ответ принимается только с адреса и порта сервера, которому был адресован запрос, с совпадающими с запросом идентификатором и длиной: раньше отправитель ответа не проверялся вовсе -! Исправление: ответ PTR от сервера имён мог записать данные за буфер ответа на стеке: обход имён шёл до конца всего сообщения вместо конца данных записи и мог принять байт-указатель сжатия за длину метки (ответ размером 3841 байт и более выходил за сам буфер); теперь обход останавливается в конце данных записи, а сжатое, пустое или обрезанное имя не принимается -! Исправление: каждое соединение, проверяемое правилом pcre: (или regex:), сопоставлялось с единственным блоком данных сопоставления правила, в который пишет pcre2_match(): два соединения, сопоставляемые одновременно, конкурировали за него и портили память, приводя процесс к падению под нагрузкой; теперь каждое соединение получает собственный блок данных сопоставления -! Исправление: TLS: чтение, возможное только после записи, или запись только после чтения (например, когда TLS 1.3 отвечает на обновление ключей, а сокет больше не принимает данные) завершало соединение с ошибкой; каждый TLS-сокет теперь помнит, чего ждут его незавершённые чтение и запись, и poll() TLS-уровня ждёт именно этого -! Исправление: Windows: чтение или запись TLS, требующая повторного обращения к сокету, не распознавалась, и соединение завершалось с посторонней ошибкой: в месте чтения ошибки сокета устанавливалась ошибка libc (errno) -! Исправление: клиент обратного соединения (connect back, -R) оставался в accept() в ожидании соединения, которое забрал другой клиент той же службы, до следующего соединения, переживая свой тайм-аут и перезагрузку конфигурации; сокет обратного соединения теперь неблокирующий, и accept() без соединения не считается попыткой клиента -! Исправление: ftppr: ответ сервера, входящего по одному USER (230, как часто бывает у анонимного FTP) или отказывающего во входе, прочитывался, но не передавался клиенту, который оставался ждать ответа на свой PASS до тайм-аута (#1284) -! Исправление: плагины: StringsPlugin, обрезая строку таблицы строк на её конце, записывал NUL за строкой, в остатки в буфере от прочитанных раньше более длинных строк или за его конец; FilePlugin передавал в socksend() состояние TLS соединения вместо параметров клиента, и отправка таблицы строк по TLS-соединению читала состояние TLS как clientparam -+ -B (для TCP-служб) разбивает проходящий через tlspr ClientHello TLS посередине имени сервера (SNI), чтобы системы DPI, не собирающие его заново, не видели имя хоста; TCP_NODELAY, устанавливаемый по умолчанию, выключать нельзя, иначе ядро может снова склеить сегменты; -s сохраняет тот же эффект там, где -s не означает splice (#1283) -+ 3proxy --help (и сообщение об использовании при неверном запуске) перечисляет, с чем собран бинарник: TLS и его серверная библиотека, RADIUS, PCRE, IPv6, сокеты Unix, встроенный HTTP-сервер, прозрачное проксирование, ODBC и необязательные прокси-службы -+ Исходящее соединение, привязываемое к внешнему адресу, на Linux 4.2 и новее привязывается с IP_BIND_ADDRESS_NO_PORT: порт выбирает connect() для пары с адресом назначения, поэтому порты, занятые соединениями к другим адресам или закрывающиеся в TIME_WAIT, больше не исчерпывают эфемерный диапазон; bind() больше не завершался с результатом 12 при большом числе соединений и не тратил миллисекунды на поиск порта +! Исправление: socks: запрос SOCKS4a отвергался как соединение с нулевым адресом, хотя в SOCKS4a нулевой адрес означает, что назначение — имя, следующее за ним +! Исправление: auth: UDP ASSOCIATE проходит предварительную авторизацию, не зная назначения, от которого зависят её правила, поэтому её вердикт относится только к этой ассоциации и не сохраняется для последующих запросов +! Исправление: socks: UDP-ассоциация передавалась напрямую при сбое родителя, хотя правила требовали родителя; теперь она отвергается +! Исправление: socks: имя хоста с управляющими байтами или пробелами принималось как есть; теперь оно отвергается там, где читается +! Исправление: smtpp: имя входа из одного порта, без хоста, задавало порт, но не называло назначения для соединения; такое имя входа теперь отвергается +! Исправление: proxy: учётные данные раннего запроса в сохранённом соединении решали и для последующих запросов; теперь каждый запрос авторизуется своими учётными данными +! Исправление: встроенный http-сервер (httpsrv): учётные данные раннего запроса в сохранённом соединении решали и для последующих запросов; теперь каждый запрос авторизуется своими учётными данными +! Исправление: tlspr: ServerHello TLS, слишком короткий для объявленной длины расширений, читался за его концом; теперь он отвергается (#1286) +! Исправление: httpsrv: запрос, для которого превышен лимит службы, всё равно выполнялся: 503, которой отвечают остальные службы, принималась за успех; теперь отвечается 503, после того как тело запроса прочитано +! Исправление: httpsrv: путь, оканчивающийся экранированной точкой-точкой или несущий её в форме, которую проверки не называли, принимался как есть; теперь любой сегмент точка-точка отвергается, где бы он ни был и каким бы разделителем ни был записан, как и путь, оканчивающийся одиночной точкой любого вида +! Исправление: pcre: правило без ACL передавалось фильтрам как данные соединения, и они читали его как блок данных сопоставления и освобождали: указатель в конфигурацию, разыменованный как другой тип и возвращённый malloc; теперь правило без ACL пропускает проверку и идёт со своим блоком diff --git a/RELEASE b/RELEASE index e4c0d46..a6a3a43 100644 --- a/RELEASE +++ b/RELEASE @@ -1 +1 @@ -1.0.3 \ No newline at end of file +1.0.4 \ No newline at end of file diff --git a/doc/changelog/1/0/4 b/doc/changelog/1/0/4 new file mode 100644 index 0000000..e054e43 --- /dev/null +++ b/doc/changelog/1/0/4 @@ -0,0 +1,11 @@ +! Fix: socks: a SOCKS4a request was refused as a connect to the null address, although in SOCKS4a the null address means that the destination is the name which follows it +! Fix: auth: a UDP ASSOCIATE is pre-authorized without looking at the destination its rules depend on, so its verdict holds for that association alone and is not kept for later requests +! Fix: socks: a UDP association was relayed direct when its parent failed, although the rules demanded the parent; it is refused now +! Fix: socks: a host name with control bytes or spaces in it was taken as it stood; it is refused where it is read now +! Fix: smtpp: a login name of a port alone, without a host, set the port but named no destination to connect to; such a login is refused now +! Fix: proxy: the credentials of an earlier request on a kept-alive connection decided for the requests after it; every request is authorized by its own credentials now +! Fix: the built-in http server (httpsrv): the credentials of an earlier request on a kept-alive connection decided for the requests after it; every request is authorized by its own credentials now +! Fix: tlspr: a TLS ServerHello too short for the extensions length it declared was read past its end; it is refused now (#1286) +! Fix: httpsrv: a request which a limit of the service exceeded was answered anyway, the 503 every other service answers with taken for success; it is answered with 503 now, after the body of the request is drained +! Fix: httpsrv: a path ending in a backslashed dot-dot, or carrying one in a form the checks did not name, was taken as it stood; any dot-dot segment is refused wherever it is and whichever separator carries it, and a path ending in a bare dot of either kind +! Fix: pcre: a rule with no ACL was handed to the filters as the connection's data, which they read as a match data block and freed: a pointer into the configuration, dereferenced as another type and given back to malloc; a rule without an ACL now skips the check and goes on with a block of its own