Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dd49e975a0 | ||
|
|
e69788b761 | ||
|
|
12a8484265 | ||
|
|
92289d5a4c | ||
|
|
c4df45b7e4 | ||
|
|
84285b640d | ||
|
|
c834073968 | ||
|
|
1289d8afc8 | ||
|
|
2935519eb7 | ||
|
|
d7c20e663f | ||
|
|
1e615e66a9 | ||
|
|
2bec15ee40 | ||
|
|
ef60434b39 | ||
|
|
31339cb161 | ||
|
|
470cc0863d | ||
|
|
6ffd9af2c7 | ||
|
|
3764b85514 | ||
|
|
84f203fb1c | ||
|
|
121be4a74e | ||
|
|
8b373f804e |
No files matched your search
@@ -27,8 +27,8 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: install valgrind
|
||||
run: sudo apt-get install --assume-yes valgrind
|
||||
- run: sudo apt update
|
||||
- run: sudo apt install --assume-yes valgrind
|
||||
- run: ./autogen.sh
|
||||
- run: ./configure --enable-debug --enable-transparent --enable-reverse
|
||||
- run: make
|
||||
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
| Version | Supported |
|
||||
| --------- | ------------------ |
|
||||
| 1.11.x | :white_check_mark: |
|
||||
| <= 1.10.x | :x: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Open a public issue on github. The issue will most likely be fixed
|
||||
within a day, unless all maintainers happen to just be taking a
|
||||
vacation at the same time, which is unlikely.
|
||||
|
||||
Even then, having the bug publicly known will allow competent people
|
||||
to come up with custom patches for distros, most likely quicker
|
||||
than black hats can craft a remote execution exploit.
|
||||
|
||||
If you really really do not want to make the issue public, come
|
||||
to the tinyproxy IRC channel and ask for a maintainer, which you
|
||||
can then contact via private messages.
|
||||
|
||||
Do not, however, like ["TALOS Intelligence"](https://talosintelligence.com/vulnerability_reports/TALOS-2023-1889)
|
||||
pull a random email address out of git log, then send an email
|
||||
nobody reads or responds to, and wait for 6 months for publication.
|
||||
this only gives black hats plenty time to sell, use and circulate
|
||||
zero days and get the best possible ROI.
|
||||
@@ -22,8 +22,8 @@ configuration file.
|
||||
The Tinyproxy configuration file contains key-value pairs, one per
|
||||
line. Lines starting with `#` and empty lines are comments and are
|
||||
ignored. Keywords are case-insensitive, whereas values are
|
||||
case-sensitive. Values may be enclosed in double-quotes (") if they
|
||||
contain spaces.
|
||||
case-sensitive. Some string values must be enclosed in double
|
||||
quotes (") as noted below.
|
||||
|
||||
The possible keywords and their descriptions are as follows:
|
||||
|
||||
@@ -57,7 +57,7 @@ only on one specific address.
|
||||
=item B<Bind>
|
||||
|
||||
This allows you to specify which address Tinyproxy will bind
|
||||
to for outgoing connections to web servers or upstream proxies.
|
||||
to for outgoing connections.
|
||||
This parameter may be specified multiple times, then Tinyproxy
|
||||
will try all the specified addresses in order.
|
||||
|
||||
@@ -76,29 +76,29 @@ allowed to have before it is closed by Tinyproxy.
|
||||
|
||||
This parameter controls which HTML file Tinyproxy returns when a
|
||||
given HTTP error occurs. It takes two arguments, the error number
|
||||
and the location of the HTML error file.
|
||||
and the location of the HTML error file. Enclose the file location
|
||||
in double quotes.
|
||||
|
||||
=item B<DefaultErrorFile>
|
||||
|
||||
This parameter controls the HTML template file returned when an
|
||||
error occurs for which no specific error file has been set.
|
||||
The HTML template file returned when an error occurs for which no
|
||||
specific error file has been set. Enclose in double quotes.
|
||||
|
||||
=item B<StatHost>
|
||||
|
||||
This configures the host name or IP address that is treated
|
||||
as the `stat host`: Whenever a request for this host is received,
|
||||
Tinyproxy will return an internal statistics page instead of
|
||||
forwarding the request to that host. The template for this
|
||||
page can be configured with the `StatFile` configuration option.
|
||||
The default value of `StatHost` is `@TINYPROXY_STATHOST@`.
|
||||
The host name or IP address that is treated as the `stat host`.
|
||||
Enclose in double quotes. Whenever Tinyproxy receives a request for
|
||||
the `stat host` it returns an internal statistics page instead of
|
||||
forwarding the request to that host. The template for this page can be
|
||||
configured with the `StatFile` configuration option. The default value
|
||||
of `StatHost` is `@TINYPROXY_STATHOST@`.
|
||||
|
||||
=item B<StatFile>
|
||||
|
||||
This configures the HTML file that Tinyproxy sends when
|
||||
a request for the stathost is received. If this parameter is
|
||||
not set, Tinyproxy returns a hard-coded basic statistics page.
|
||||
See the STATHOST section in the L<tinyproxy(8)> manual page
|
||||
for details.
|
||||
The HTML file that Tinyproxy sends in response to a request for the
|
||||
`stat host`. Enclose in double quotes. If this parameter is not set,
|
||||
Tinyproxy returns a hard-coded basic statistics page. See the STATHOST
|
||||
section in the L<tinyproxy(8)> manual page for details.
|
||||
|
||||
Note that the StatFile and the error files configured with ErrorFile
|
||||
and DefaultErrorFile are template files that can contain a few
|
||||
@@ -109,9 +109,9 @@ manual page contains a description of all template variables.
|
||||
|
||||
=item B<LogFile>
|
||||
|
||||
This controls the location of the file to which Tinyproxy
|
||||
writes its debug output. Alternatively, Tinyproxy can log
|
||||
to syslog -- see the Syslog option.
|
||||
The location of the file to which Tinyproxy writes its debug output.
|
||||
Enclose in double quotes. Alternatively, Tinyproxy can log to syslog
|
||||
-- see the Syslog option.
|
||||
|
||||
=item B<Syslog>
|
||||
|
||||
@@ -144,8 +144,8 @@ and below would be suppressed. Allowed values are:
|
||||
|
||||
=item B<PidFile>
|
||||
|
||||
This option controls the location of the file where the main
|
||||
Tinyproxy process stores its process ID for signaling purposes.
|
||||
The location of the file where the main Tinyproxy process stores its
|
||||
process ID for signaling purposes. Enclose in double quotes.
|
||||
|
||||
=item B<XTinyproxy>
|
||||
|
||||
@@ -179,6 +179,10 @@ connection is done directly.
|
||||
|
||||
=back
|
||||
|
||||
It's recommended to use raw IP addresses to specify the upstream host, so
|
||||
no costly DNS lookup has to be done everytime it is used.
|
||||
IPv6 addresses need to be enclosed in square brackets.
|
||||
|
||||
The site can be specified in various forms as a hostname, domain
|
||||
name or as an IP range:
|
||||
|
||||
@@ -250,7 +254,8 @@ RFC 2616 requires proxies to add a `Via` header to the HTTP
|
||||
requests, but using the real host name can be a security
|
||||
concern. If the `ViaProxyname` option is present, then its
|
||||
string value will be used as the host name in the Via header.
|
||||
Otherwise, the server's host name will be used.
|
||||
Otherwise, the server's host name will be used. Enclose in double
|
||||
quotes.
|
||||
|
||||
=item B<DisableViaHeader>
|
||||
|
||||
@@ -344,7 +349,7 @@ If an `Anonymous` keyword is present, then anonymous proxying
|
||||
is enabled. The headers listed with `Anonymous` are allowed
|
||||
through, while all others are denied. If no Anonymous keyword
|
||||
is present, then all headers are allowed through. You must
|
||||
include quotes around the headers.
|
||||
include double quotes around the headers.
|
||||
|
||||
Most sites require cookies to be enabled for them to work correctly, so
|
||||
you will need to allow cookies through if you access those sites.
|
||||
|
||||
+21
-5
@@ -41,25 +41,27 @@
|
||||
|
||||
<p>Tinyproxy requires only a <strong>minimal POSIX environment</strong> to build and operate. It can use additional libraries to add functionality though.</p>
|
||||
|
||||
<p>Tinyproxy allows forwarding of <strong>HTTPS connections</strong> without modifying traffic in any way through the <code>CONNECT</code> method (see the <code>ConnectPort</code> directive).</p>
|
||||
<p>Tinyproxy allows forwarding of <strong>HTTPS connections</strong> without modifying traffic in any way through the <code>CONNECT</code> method (see the <code>ConnectPort</code> directive, which you should disable, unless you want to restrict the users).</p>
|
||||
|
||||
<p>Tinyproxy supports being configured as a <strong>transparent proxy</strong>, so that a proxy can be used without requiring any client-side configuration. You can also use it as a <strong>reverse proxy</strong> front-end to your websites.</p>
|
||||
|
||||
<p>Using the <code>AddHeader</code> directive, you can <strong>add/insert HTTP headers</strong> to outgoing traffic.</p>
|
||||
<p>Using the <code>AddHeader</code> directive, you can <strong>add/insert HTTP headers</strong> to outgoing traffic (HTTP only).</p>
|
||||
|
||||
<p>If you're looking to build a custom web proxy, Tinyproxy is <strong>easy to modify</strong> to your custom needs. The source is straightforward, adhering to the KISS principle. As such, it can be used as a foundation for anything you may need a web proxy to do.</p>
|
||||
|
||||
<p>Tinyproxy has <strong>privacy features</strong> which can let you configure which HTTP headers should be allowed through, and which should be blocked. This allows you to restrict both what data comes to your web browser from the HTTP server (e.g., cookies), and to restrict what data is allowed through from your web browser to the HTTP server (e.g., version information).</p>
|
||||
<p>Tinyproxy has <strong>privacy features</strong> which can let you configure which HTTP headers should be allowed through, and which should be blocked. This allows you to restrict both what data comes to your web browser from the HTTP server (e.g., cookies), and to restrict what data is allowed through from your web browser to the HTTP server (e.g., version information). Note that these features do not affect HTTPS connections.</p>
|
||||
|
||||
<p>Using the <strong>remote monitoring</strong> facility, you can access proxy statistics from afar, letting you know exactly how busy the proxy is.</p>
|
||||
|
||||
<p>You can configure Tinyproxy to <strong>control access</strong> by only allowing requests from a certain subnet, or from a certain interface, thus ensuring that random, unauthorized people will not be using your proxy.</p>
|
||||
|
||||
<p>With a bit of configuration (specifically, making Tinyproxy created files owned by a non-root user and running it on a port greater than 1024), Tinyproxy can be made to run without any special privileges, thus minimizing the chance of system compromise. Furthermore, it was designed with an eye towards preventing buffer overflows. The simplicity of the code ensures it remains easy to spot such bugs.</p>
|
||||
<p>With a bit of configuration (specifically, making Tinyproxy created files owned by a non-root user and running it on a port greater than 1024), Tinyproxy can be made to run without any special privileges, thus minimizing the chance of system compromise. In fact, it is <b>recommended</b> to run it as a regular/restricted user. Furthermore, it was designed with an eye towards preventing buffer overflows. The simplicity of the code ensures it remains easy to spot such bugs.</p>
|
||||
|
||||
<h2>
|
||||
<a id="downloads" class="anchor" href="#downloads" aria-hidden="true"><span class="octicon octicon-link"></span></a>Downloads</h2>
|
||||
|
||||
<p>Note that many distributions ship horribly outdated versions of tinyproxy, therefore it is recommended to compile it from source.</p>
|
||||
|
||||
<ul>
|
||||
<li>On Red Hat Enterprise Linux, or its derivatives such as CentOS, install Tinyproxy from the EPEL repository by running yum install tinyproxy.</li>
|
||||
<li>On Fedora, install Tinyproxy by running yum install tinyproxy.</li>
|
||||
@@ -70,7 +72,7 @@
|
||||
<li>Mac OS X users can check MacPorts to see if the Tinyproxy port there is recent enough.</li>
|
||||
</ul>
|
||||
|
||||
<p>If you feel that the Tinyproxy binary package in your operating system is not recent, please contact the package maintainer for that particular operating system. If this fails, you can always compile the latest stable version from source code.</p>
|
||||
<p>If you feel that the Tinyproxy binary package in your operating system is not recent (likely), please contact the package maintainer for that particular operating system. If this fails, you can always compile the latest stable, or even better, the latest git master version, from source code.</p>
|
||||
|
||||
<p>We distribute Tinyproxy in source code form, and it has to be compiled in order to be used on your system. Please see the INSTALL file in the source code tree for build instructions. The current stable version of Tinyproxy is available on the <a href="https://github.com/tinyproxy/tinyproxy/releases">releases page</a>. The Tinyproxy NEWS file contains the release notes. You can verify the tarball using its PGP signature. You can also browse the older releases of Tinyproxy.</p>
|
||||
|
||||
@@ -78,5 +80,19 @@
|
||||
|
||||
<p>git clone <a href="https://github.com/tinyproxy/tinyproxy.git">https://github.com/tinyproxy/tinyproxy.git</a></p>
|
||||
|
||||
<h2>
|
||||
<a id="quickstart" class="anchor" href="#quickstart" aria-hidden="true"><span class="octicon octicon-link"></span></a>Quickstart</h2>
|
||||
|
||||
<p>The quickest way to get started is using a minimal config file like the below:</p>
|
||||
|
||||
<pre><code>
|
||||
Port 8888
|
||||
Listen 127.0.0.1
|
||||
Timeout 600
|
||||
Allow 127.0.0.1
|
||||
</code></pre>
|
||||
|
||||
<p>And then simply run <code>tinyproxy -d -c tinyproxy.conf</code> as your current user. This starts tinyproxy in foreground mode with <code>tinyproxy.conf</code> as its config, while logging to stdout. Now, all programs supporting a HTTP proxy can use 127.0.0.1:8888 as a proxy. You can try it out using <code>http_proxy=127.0.0.1:8888 curl example.com</code>.</p>
|
||||
|
||||
<h2>
|
||||
<a id="documentation" class="anchor" href="#documentation" aria-hidden="true"><span class="octicon octicon-link"></span></a>Documentation</h2>
|
||||
@@ -3,7 +3,7 @@
|
||||
##
|
||||
## This example tinyproxy.conf file contains example settings
|
||||
## with explanations in comments. For decriptions of all
|
||||
## parameters, see the tinproxy.conf(5) manual page.
|
||||
## parameters, see the tinyproxy.conf(5) manual page.
|
||||
##
|
||||
|
||||
#
|
||||
|
||||
+2
-1
@@ -81,7 +81,7 @@ void child_main_loop (void)
|
||||
int connfd;
|
||||
union sockaddr_union cliaddr_storage;
|
||||
struct sockaddr *cliaddr = (void*) &cliaddr_storage;
|
||||
socklen_t clilen = sizeof(cliaddr_storage);
|
||||
socklen_t clilen;
|
||||
int nfds = sblist_getsize(listen_fds);
|
||||
pollfd_struct *fds = safecalloc(nfds, sizeof *fds);
|
||||
ssize_t i;
|
||||
@@ -167,6 +167,7 @@ void child_main_loop (void)
|
||||
* Continue handling this connection.
|
||||
*/
|
||||
|
||||
clilen = sizeof(cliaddr_storage);
|
||||
connfd = accept (listenfd, cliaddr, &clilen);
|
||||
|
||||
|
||||
|
||||
+13
-9
@@ -66,9 +66,10 @@
|
||||
#define PASSWORD "([^@]*)"
|
||||
#define IP "((([0-9]{1,3})\\.){3}[0-9]{1,3})"
|
||||
#define IPMASK "(" IP "(/" DIGIT "+)?)"
|
||||
#define IPV6SCOPE "((%[^ \t\\/]{1,16})?)"
|
||||
#define IPV6 "(" \
|
||||
"(([0-9a-f:]{2,39}))|" \
|
||||
"(([0-9a-f:]{0,29}:" IP "))" \
|
||||
"([0-9a-f:]{2,39})" IPV6SCOPE "|" \
|
||||
"([0-9a-f:]{0,29}:" IP ")" IPV6SCOPE \
|
||||
")"
|
||||
|
||||
#define IPV6MASK "(" IPV6 "(/" DIGIT "+)?)"
|
||||
@@ -80,7 +81,7 @@
|
||||
* number. Given the usual structure of the configuration file, sixteen
|
||||
* substring matches should be plenty.
|
||||
*/
|
||||
#define RE_MAX_MATCHES 24
|
||||
#define RE_MAX_MATCHES 33
|
||||
|
||||
#define CP_WARN(FMT, ...) \
|
||||
log_message (LOG_WARNING, "line %lu: " FMT, lineno, __VA_ARGS__)
|
||||
@@ -224,7 +225,7 @@ struct {
|
||||
handle_deny),
|
||||
STDCONF (bind, "(" IP "|" IPV6 ")", handle_bind),
|
||||
/* other */
|
||||
STDCONF (basicauth, ALNUM WS ALNUM, handle_basicauth),
|
||||
STDCONF (basicauth, USERNAME WS PASSWORD, handle_basicauth),
|
||||
STDCONF (errorfile, INT WS STR, handle_errorfile),
|
||||
STDCONF (addheader, STR WS STR, handle_addheader),
|
||||
|
||||
@@ -249,7 +250,7 @@ struct {
|
||||
"(" "(none)" WS STR ")|" \
|
||||
"(" "(http|socks4|socks5)" WS \
|
||||
"(" USERNAME /*username*/ ":" PASSWORD /*password*/ "@" ")?"
|
||||
"(" IP "|" ALNUM ")"
|
||||
"(" IP "|" "\\[(" IPV6 ")\\]" "|" ALNUM ")"
|
||||
":" INT "(" WS STR ")?" ")", handle_upstream),
|
||||
#endif
|
||||
/* loglevel */
|
||||
@@ -427,7 +428,7 @@ static int config_parse (struct config_s *conf, FILE * f)
|
||||
while(isspace(*p))p++;
|
||||
if(!*p) continue;
|
||||
q = p;
|
||||
while(!isspace(*q))q++;
|
||||
while(*q && !isspace(*q))q++;
|
||||
c = *q;
|
||||
*q = 0;
|
||||
e = config_directive_find(p, strlen(p));
|
||||
@@ -1008,7 +1009,7 @@ static HANDLE_FUNC (handle_filtertype)
|
||||
if (!type) return -1;
|
||||
|
||||
for(i=0;i<sizeof(ftmap)/sizeof(ftmap[0]);++i)
|
||||
if(!strcmp(ftmap[i].type, type))
|
||||
if(!strcasecmp(ftmap[i].type, type))
|
||||
conf->filter_opts |= ftmap[i].flag;
|
||||
|
||||
safefree (type);
|
||||
@@ -1114,10 +1115,13 @@ static HANDLE_FUNC (handle_upstream)
|
||||
pass = get_string_arg (line, &match[mi]);
|
||||
mi++;
|
||||
|
||||
ip = get_string_arg (line, &match[mi]);
|
||||
if (match[mi+4].rm_so != -1) /* IPv6 address in square brackets */
|
||||
ip = get_string_arg (line, &match[mi+4]);
|
||||
else
|
||||
ip = get_string_arg (line, &match[mi]);
|
||||
if (!ip)
|
||||
return -1;
|
||||
mi += 5;
|
||||
mi += 16;
|
||||
|
||||
port = (int) get_long_arg (line, &match[mi]);
|
||||
mi += 3;
|
||||
|
||||
+4
-1
@@ -80,9 +80,10 @@ static int resize(struct htab *htab, size_t nel)
|
||||
{
|
||||
size_t newsize;
|
||||
size_t i, j;
|
||||
size_t oldmask = htab->mask;
|
||||
struct elem *e, *newe;
|
||||
struct elem *oldtab = htab->elems;
|
||||
struct elem *oldend = htab->elems + htab->mask + 1;
|
||||
struct elem *oldend;
|
||||
|
||||
if (nel > MAXSIZE)
|
||||
nel = MAXSIZE;
|
||||
@@ -95,6 +96,8 @@ static int resize(struct htab *htab, size_t nel)
|
||||
htab->mask = newsize - 1;
|
||||
if (!oldtab)
|
||||
return 1;
|
||||
|
||||
oldend = oldtab + oldmask + 1;
|
||||
for (e = oldtab; e < oldend; e++)
|
||||
if (e->item.key) {
|
||||
for (i=e->hash,j=1; ; i+=j++) {
|
||||
|
||||
+1
-1
@@ -257,7 +257,7 @@ int reload_config (int reload_logging)
|
||||
int ret, ret2;
|
||||
struct config_s *c_next = get_next_config();
|
||||
|
||||
log_message (LOG_NOTICE, "Reloading config file");
|
||||
log_message (LOG_NOTICE, "Reloading config file (%s)", config_file);
|
||||
|
||||
if (reload_logging) shutdown_logging ();
|
||||
|
||||
|
||||
+37
-24
@@ -301,21 +301,16 @@ establish_http_connection (struct conn_s *connptr, struct request_s *request)
|
||||
}
|
||||
|
||||
/*
|
||||
* These two defines are for the SSL tunnelling.
|
||||
* Send the appropriate response to the client to establish a
|
||||
* connection via CONNECT method.
|
||||
*/
|
||||
#define SSL_CONNECTION_RESPONSE "HTTP/1.0 200 Connection established"
|
||||
#define PROXY_AGENT "Proxy-agent: " PACKAGE "/" VERSION
|
||||
|
||||
/*
|
||||
* Send the appropriate response to the client to establish a SSL
|
||||
* connection.
|
||||
*/
|
||||
static int send_ssl_response (struct conn_s *connptr)
|
||||
static int send_connect_method_response (struct conn_s *connptr)
|
||||
{
|
||||
return write_message (connptr->client_fd,
|
||||
"%s\r\n"
|
||||
"%s\r\n"
|
||||
"\r\n", SSL_CONNECTION_RESPONSE, PROXY_AGENT);
|
||||
"HTTP/1.%u 200 Connection established\r\n"
|
||||
"Proxy-agent: " PACKAGE "/" VERSION "\r\n"
|
||||
"\r\n", connptr->protocol.major != 1 ? 0 :
|
||||
connptr->protocol.minor);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -327,9 +322,11 @@ static struct request_s *process_request (struct conn_s *connptr,
|
||||
{
|
||||
char *url;
|
||||
struct request_s *request;
|
||||
int ret;
|
||||
int ret, skip_trans;
|
||||
size_t request_len;
|
||||
|
||||
skip_trans = 0;
|
||||
|
||||
/* NULL out all the fields so frees don't cause segfaults. */
|
||||
request =
|
||||
(struct request_s *) safecalloc (1, sizeof (struct request_s));
|
||||
@@ -346,8 +343,12 @@ static struct request_s *process_request (struct conn_s *connptr,
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* zero-terminate the strings so they don't contain junk in error page */
|
||||
request->method[0] = url[0] = request->protocol[0] = 0;
|
||||
|
||||
ret = sscanf (connptr->request_line, "%[^ ] %[^ ] %[^ ]",
|
||||
request->method, url, request->protocol);
|
||||
|
||||
if (ret == 2 && !strcasecmp (request->method, "GET")) {
|
||||
request->protocol[0] = 0;
|
||||
|
||||
@@ -402,6 +403,7 @@ BAD_REQUEST_ERROR:
|
||||
}
|
||||
safefree (url);
|
||||
url = reverse_url;
|
||||
skip_trans = 1;
|
||||
} else if (config->reverseonly) {
|
||||
log_message (LOG_ERR,
|
||||
"Bad request, no mapping for '%s' found",
|
||||
@@ -451,11 +453,13 @@ BAD_REQUEST_ERROR:
|
||||
connptr->connect_method = TRUE;
|
||||
} else {
|
||||
#ifdef TRANSPARENT_PROXY
|
||||
if (!do_transparent_proxy
|
||||
(connptr, hashofheaders, request, config, &url)) {
|
||||
goto fail;
|
||||
}
|
||||
#else
|
||||
if (!skip_trans) {
|
||||
if (!do_transparent_proxy
|
||||
(connptr, hashofheaders, request, config, &url))
|
||||
goto fail;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
indicate_http_error (connptr, 501, "Not Implemented",
|
||||
"detail",
|
||||
"Unknown method or unsupported protocol.",
|
||||
@@ -463,7 +467,7 @@ BAD_REQUEST_ERROR:
|
||||
log_message (LOG_INFO, "Unknown method (%s) or protocol (%s)",
|
||||
request->method, url);
|
||||
goto fail;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef FILTER_ENABLE
|
||||
@@ -775,7 +779,7 @@ static int remove_connection_headers (orderedmap hashofheaders)
|
||||
char *data;
|
||||
char *ptr;
|
||||
ssize_t len;
|
||||
int i;
|
||||
int i,j,df;
|
||||
|
||||
for (i = 0; i != (sizeof (headers) / sizeof (char *)); ++i) {
|
||||
/* Look for the connection header. If it's not found, return. */
|
||||
@@ -800,7 +804,12 @@ static int remove_connection_headers (orderedmap hashofheaders)
|
||||
*/
|
||||
ptr = data;
|
||||
while (ptr < data + len) {
|
||||
orderedmap_remove (hashofheaders, ptr);
|
||||
df = 0;
|
||||
/* check that ptr isn't one of headers to prevent
|
||||
double-free (CVE-2023-49606) */
|
||||
for (j = 0; j != (sizeof (headers) / sizeof (char *)); ++j)
|
||||
if(!strcasecmp(ptr, headers[j])) df = 1;
|
||||
if (!df) orderedmap_remove (hashofheaders, ptr);
|
||||
|
||||
/* Advance ptr to the next token */
|
||||
ptr += strlen (ptr) + 1;
|
||||
@@ -1684,6 +1693,10 @@ void handle_connection (struct conn_s *connptr, union sockaddr_union* addr)
|
||||
if(failure) {
|
||||
e401:
|
||||
update_stats (STAT_DENIED);
|
||||
log_message (LOG_INFO,
|
||||
"Failed auth attempt (file descriptor: %d), ip %s",
|
||||
connptr->client_fd,
|
||||
connptr->client_ip_addr);
|
||||
indicate_http_error (connptr, 401, "Unauthorized",
|
||||
"detail",
|
||||
"The administrator of this proxy has not configured "
|
||||
@@ -1762,10 +1775,10 @@ e401:
|
||||
HC_FAIL();
|
||||
}
|
||||
} else {
|
||||
if (send_ssl_response (connptr) < 0) {
|
||||
if (send_connect_method_response (connptr) < 0) {
|
||||
log_message (LOG_ERR,
|
||||
"handle_connection: Could not send SSL greeting "
|
||||
"to client.");
|
||||
"handle_connection: Could not send CONNECT"
|
||||
" method greeting to client.");
|
||||
update_stats (STAT_BADCONN);
|
||||
HC_FAIL();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user