Skip to content

Commit

Permalink
Warn about http-relay usage
Browse files Browse the repository at this point in the history
http-relay should be avoided due to CVE-2009-0801. It was implemented to
support ancient HTTP/1.0 clients that did not set `Host` header, so
upstream proxy had at least some way to determine request destination.

In modern post-SPDY world this method should not be used, you should
rather configure upstream proxy to accept CONNECT requests to any port
and use `http-connect` instead.

Great CVE-2009-0801 description can be found in squid-users on 2015-12-18
http://lists.squid-cache.org/pipermail/squid-users/2015-December/008392.html
  • Loading branch information
darkk committed Apr 3, 2016
1 parent c6c5cb9 commit 3c7f635
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions http-relay.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ static void httpr_client_fini(redsocks_client *client)
httpr_buffer_fini(&httpr->relay_buffer);
}

static void httpr_instance_init(redsocks_instance *instance)
{
log_error(LOG_WARNING, "You should avoid `http-relay`, e.g. due to CVE-2009-0801");
}

static void httpr_instance_fini(redsocks_instance *instance)
{
http_auth *auth = (void*)(instance + 1);
Expand Down Expand Up @@ -574,6 +579,7 @@ relay_subsys http_relay_subsys =
.connect_relay = httpr_connect_relay,
.readcb = httpr_relay_read_cb,
.writecb = httpr_relay_write_cb,
.instance_init = httpr_instance_init,
.instance_fini = httpr_instance_fini,
};

Expand Down
3 changes: 3 additions & 0 deletions redsocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -1308,6 +1308,9 @@ static int redsocks_init_instance(redsocks_instance *instance)
goto fail;
}

if (instance->relay_ss->instance_init)
instance->relay_ss->instance_init(instance);

return 0;

fail:
Expand Down
1 change: 1 addition & 0 deletions redsocks.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ typedef struct relay_subsys_t {
evbuffercb writecb;
void (*init)(struct redsocks_client_t *client);
void (*fini)(struct redsocks_client_t *client);
void (*instance_init)(struct redsocks_instance_t *instance);
void (*instance_fini)(struct redsocks_instance_t *instance);
// connect_relay (if any) is called instead of redsocks_connect_relay after client connection acceptance
void (*connect_relay)(struct redsocks_client_t *client);
Expand Down

0 comments on commit 3c7f635

Please sign in to comment.