Skip to content

Commit ee6da90

Browse files
committed
CVE-2016-1000109: Ignore Proxy HTTP header from fastcgi requests
The default PHP behavior is to transform a Proxy header from requests into the HTTP_PROXY environment variable in the PHP environment running the request. Some scripts may use this env var to decide which HTTP proxy to connect to, and we don't want requests to have that kind of control over scripts' behavior.
1 parent 39fc688 commit ee6da90

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

hphp/runtime/server/fastcgi/fastcgi-transport.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,10 @@ void FastCGITransport::onHeader(std::unique_ptr<folly::IOBuf> key_chain,
212212
Cursor keyCur(key_chain.get());
213213
auto key = keyCur.readFixedString(key_chain->computeChainDataLength());
214214

215+
// Don't allow requests to inject an HTTP_PROXY environment variable by
216+
// sending a Proxy header.
217+
if (strcasecmp(key.c_str(), "HTTP_PROXY") == 0) return;
218+
215219
Cursor valCur(value_chain.get());
216220
auto value = valCur.readFixedString(value_chain->computeChainDataLength());
217221

0 commit comments

Comments
 (0)