Security-Portal.cz je internetový portál zaměřený na počítačovou bezpečnost, hacking, anonymitu, počítačové sítě, programování, šifrování, exploity, Linux a BSD systémy. Provozuje spoustu zajímavých služeb a podporuje příznivce v zajímavých projektech.

Kategorie

U.S. Officials Say Huawei Can Covertly Access Telecom Networks>

LinuxSecurity.com - 12 Únor, 2020 - 15:49
Huawei can covertly access mobile networks through back doors meant for law enforcement, the U.S. has told allies in a bid to show that the firm poses a security threat. 
Kategorie: Hacking & Security

Katie Moussouris: The Bug Bounty Conflict of Interest

Threatpost - 12 Únor, 2020 - 15:37
Katie Moussouris sounds off on the challenges behind creating successful bug bounty programs.
Kategorie: Hacking & Security

How to configure Picture Passwords and PINs in Windows 10

InfoSec Institute Resources - 12 Únor, 2020 - 15:05

Introduction When you first think of the concept of a picture password, you may think of something like the old TV show classic “Concentration,” or a typical emoji-based conversation — a bunch of pictograms coming together to create a specific phrase or idea. In reality, however, it’s actually much more similar to a hidden object […]

The post How to configure Picture Passwords and PINs in Windows 10 appeared first on Infosec Resources.

How to configure Picture Passwords and PINs in Windows 10 was first posted on February 12, 2020 at 8:05 am.
©2017 "InfoSec Resources". Use of this feed is for personal non-commercial use only. If you are not reading this article in your feed reader, then the site is guilty of copyright infringement. Please contact me at darren.dalasta@infosecinstitute.com
Kategorie: Hacking & Security

Zero-day attacks: Protections, best practices and how to implement them

InfoSec Institute Resources - 12 Únor, 2020 - 15:01

Introduction Zero-day attacks are one of the most dangerous cybersecurity threats. This type of cyberattack targets software vulnerabilities previously unknown to software or antivirus vendors, exploiting those vulnerabilities before they can be mitigated. As a result, zero-day attacks enter a system without any defenses in place — giving administrators zero days to fix the already […]

The post Zero-day attacks: Protections, best practices and how to implement them appeared first on Infosec Resources.

Zero-day attacks: Protections, best practices and how to implement them was first posted on February 12, 2020 at 8:01 am.
©2017 "InfoSec Resources". Use of this feed is for personal non-commercial use only. If you are not reading this article in your feed reader, then the site is guilty of copyright infringement. Please contact me at darren.dalasta@infosecinstitute.com
Kategorie: Hacking & Security

Considering cyber insurance? Here’s what you need to know

InfoSec Institute Resources - 12 Únor, 2020 - 15:00

The growing need for cyber insurance Fueled by the growing number of data breaches, an expanding attack surface and a shortage of cybersecurity talent, cyber risk is a mounting concern for organizations across all industries. A survey of risk managers by consultancy Allianz identified cyber incidents as the top-ranked business risk globally (tied with business […]

The post Considering cyber insurance? Here’s what you need to know appeared first on Infosec Resources.

Considering cyber insurance? Here’s what you need to know was first posted on February 12, 2020 at 8:00 am.
©2017 "InfoSec Resources". Use of this feed is for personal non-commercial use only. If you are not reading this article in your feed reader, then the site is guilty of copyright infringement. Please contact me at darren.dalasta@infosecinstitute.com
Kategorie: Hacking & Security

Industrial Ethernet

InfoSec Institute Resources - 12 Únor, 2020 - 15:00

Introduction Industrial Control Systems (ICS) are different from conventional IT systems. ICS typically source data from remote sensors and transmit commands to machines for the relevant action to take. As such, conventional IT protocols cannot be applied to ICS. Every instrument, interface and system in the ICS landscape now support and run on TCP/IP protocols […]

The post Industrial Ethernet appeared first on Infosec Resources.

Industrial Ethernet was first posted on February 12, 2020 at 8:00 am.
©2017 "InfoSec Resources". Use of this feed is for personal non-commercial use only. If you are not reading this article in your feed reader, then the site is guilty of copyright infringement. Please contact me at darren.dalasta@infosecinstitute.com
Kategorie: Hacking & Security

Report to Your Management with the Definitive ‘IR Management and Reporting’ Presentation Template

Threatpost - 12 Únor, 2020 - 15:00
The IR Management and Reporting Template attempt to assist the CISO – not only perform a top edge response to cyberattacks but also ensure that this professional and critical work is understood and acknowledged.
Kategorie: Hacking & Security

FBI: $3.5B Lost in 2019 to Known Cyberscams, Ransomware

Threatpost - 12 Únor, 2020 - 14:50
Cybercriminals double down on successful internet scams, with a focus on phishing, BEC and other defrauding schemes that have proven to work.
Kategorie: Hacking & Security

Download: Definitive 'IR Management and Reporting' Presentation Template

The Hacker News - 12 Únor, 2020 - 14:35
The realistic approach to security is that incidents occur. While ideally, the CISO would want to prevent all of them, in practice, some will succeed to a certain degree—making the ability to efficiently manage an incident response process a mandatory skill for any CISO. Moreover, apart from the management of the actual response process, the CISO must also be able to efficiently communicate
Kategorie: Hacking & Security

Emotet Malware Now Hacks Nearby Wi-Fi Networks to Infect New Victims

The Hacker News - 12 Únor, 2020 - 13:47
Emotet, the notorious trojan behind a number of botnet-driven spam campaigns and ransomware attacks, has found a new attack vector: using already infected devices to identify new victims that are connected to nearby Wi-Fi networks. According to researchers at Binary Defense, the newly discovered Emotet sample leverages a "Wi-Fi spreader" module to scan Wi-Fi networks, and then attempts to
Kategorie: Hacking & Security

US charges four Chinese military members with Equifax hack

Sophos Naked Security - 12 Únor, 2020 - 12:48
The indictment suggests the hack was part of a series of major data thefts organized by Chinese military and intelligence agencies.

Data about inmates and jail staff spilled by leaky prison app

Sophos Naked Security - 12 Únor, 2020 - 11:16
A web-mapping project came across detainees' prescriptions and other PII that could be used by identity thieves to victimize prisoners.

Stopy velkého hackerského útoku na americký Equifax vedou do Číny

Novinky.cz - bezpečnost - 12 Únor, 2020 - 10:15
Za rozsáhlým průnikem do sítě americké úvěrové kanceláře Equifax, který v roce 2017 postihl na 150 milionů Američanů, stojí čtveřice čínských vojenských hackerů. Oznámil to americký ministr spravedlnosti William Barr. I když nikdo z hackerů nebyl zadržen, USA čtveřici formálně obvinily, protože takový postup podle agentury Reuters považují za odstrašující prostředek a za varování ostatním zemím.
Kategorie: Hacking & Security

Microsoft Addresses Active Attacks, Air-Gap Danger with 99 Patches

Threatpost - 11 Únor, 2020 - 23:06
There are 12 critical and five previously disclosed bugs in the February 2020 Patch Tuesday Update.
Kategorie: Hacking & Security

Update Microsoft Windows Systems to Patch 99 New Security Flaws

The Hacker News - 11 Únor, 2020 - 21:04
A few hours after Adobe today released security updates for five of its widely-distributed software, Microsoft also issued its February 2020 Patch Tuesday edition with patches for a total of 99 new vulnerabilities. According to the advisories, 12 of the total issues patched by the tech giant this month are critical in severity, and the remaining 87 have been listed as important. Five of the
Kategorie: Hacking & Security

Intel Patches High-Severity Flaw in Security Engine

Threatpost - 11 Únor, 2020 - 20:46
The high-severity vulnerability could enable denial of service, privilege escalation and information disclosure.
Kategorie: Hacking & Security

Boeing musí řešit další problém s letouny 737 Max – nefunguje jim kontrolka

Zive.cz - bezpečnost - 11 Únor, 2020 - 20:00
Letouny 737 Max, které jsou bezmála rok uzemněné po dvou tragických haváriích, přidělávají Boeingu další vrásky na čele. V systému varování byla odhalena další chyba, jejíž oprava by však údajně neměla zpozdit termín návratu těchto strojů na oblohu. Bloomberg informuje, že výrobce během letových ...
Kategorie: Hacking & Security

Estée Lauder Exposes 440M Records, with Email Addresses, Network Info

Threatpost - 11 Únor, 2020 - 19:52
Middleware data was exposed, which can create a secondary path for malware through which applications and data can be compromised.
Kategorie: Hacking & Security

Adobe Releases Patches for Dozens of Critical Flaws in 5 Software

The Hacker News - 11 Únor, 2020 - 18:43
Here comes the second 'Patch Tuesday' of this year. Adobe today released the latest security updates for five of its widely used software that patch a total of 42 newly discovered vulnerabilities, 35 of which are critical in severity. The first four of the total five affected software, all listed below, are vulnerable to at least one critical arbitrary code execution vulnerability that could
Kategorie: Hacking & Security

A day^W^W Several months in the life of Project Zero - Part 2: The Chrome exploit of suffering

Project Zero - 11 Únor, 2020 - 18:30
Posted by Sergei Glazunov and Mark Brand, Project ZeroIntroductionAfter we’d understood how the bug worked, and had passed on those details to Chrome to help them get started on a fix, we went back to our other projects. This bug remained a topic of discussion, and eventually we ran out of excuses for not trying to write an exploit for it. 
One of the main reasons for doing this was to understand how readily exploitable bugs in the Chrome network stack are, given the relatively recent changes in the process architecture. Nobody in the team had taken a serious look at exploiting an issue in the network stack in Chrome, so it would likely give some more interesting insights than an exploit targeting more well-understood areas of the codebase, such as renderer bugs or the more typical browser-process sandbox escape targets.
While it may take you just a matter of minutes to read this post; the work behind it took a little longer, with many more failures than successes, even though the end result was a working "single-bug-chain" Chrome exploit.
Many of our failures weren’t due to any particular difficulty, and instead due to carelessness, which seems somehow more problematic when working with unreliable primitives; it’s easy to spend a whole day debugging a failing heap groom without, for example, noticing that you have the webserver running on the wrong port… Chapter 4. The Exploit.We finished last time with quite a powerful primitive; the vulnerability gave us a write of controlled data of a chosen size past the end of a heap allocation. There was just one major drawback to overcome — due to the way the bug works, the allocation that we’re overwriting will always be of size 0.
As most other allocators, tcmalloc stores it in the smallest class size, which is "up to 16 bytes" in this case. There are two issues with the size class. Firstly, "useful" objects (i.e. the ones that contain pointers we might want to overwrite) are usually larger than that. Secondly, the size class is rather congested as virtually every IPC call to the network process triggers allocations and deallocations in it. Therefore we can’t use, for example, the "heavy" fetch API, for heap spraying / grooming. Unfortunately, there are few object types in the network process that fit into 16 bytes and the creation of which doesn’t trigger a bunch of other allocations.
There was some good news too. If the network process crashes it will be silently restarted, so we would be able to use this as a crutch if we were struggling with reliability — our exploit would be able to try several times before it succeeds.NetToMojoPendingBufferWe were able to find an object that was suitable for constructing a "write-what-where" primitive relatively quickly by just enumerating small classes related to the network process. A new NetToMojoPendingBuffer object is created on every URLLoader::ReadMore call, so the attacker can control these allocations by delaying the dispatch of response chunks on the web server side.
class COMPONENT_EXPORT(NETWORK_CPP) NetToMojoPendingBuffer    : public base::RefCountedThreadSafe<NetToMojoPendingBuffer> {  mojo::ScopedDataPipeProducerHandle handle_;  void* buffer_;};
We don’t have to worry about overwriting handle_ because when Chrome encounters an invalid handle it just returns early without crashing. The data that will get written to the buffer’s backing store is exactly the next HTTP response chunk, so it’s also fully controlled.
There’s a problem, though — the primitive alone won’t suffice without a separate infoleak. An obvious idea to make it more powerful would be to perform a partial overwrite of buffer_ and subsequently corrupt an object in some other (hopefully more convenient) size class. However, the pointer never gets assigned to a regular heap address. Instead, the backing store for NetToMojoPendingBuffer objects is allocated inside a shared memory region that’s only used for IPC and doesn’t contain objects, so there’s nothing to corrupt there.
Apart from NetToMojoPendingBuffer, we couldn’t find anything in the 16-byte size class that would look immediately useful.Going after STL containers.Luckily, we’re not limited to C++ classes and structures. Instead, we can target arbitrarily sized buffers like container backing stores. For example, when an element is being inserted into an empty std::vector, we allocate a backing store with space for just a single element. On subsequent insertions, if there’s no space left it gets doubled. Some other container classes operate in a similar way. Thus, if we precisely control insertions to, e.g., a vector of pointers, we can perform a partial overwrite of one of the pointers to turn the bug into a type confusion of some sort.WatcherDispatcher.A crash related to WatcherDispatcher showed up while we were experimenting with NetToMojoPendingBuffer. The WatcherDispatcher class is not specific to the network process. It’s one of the basic Mojo structures, used everywhere that IPC messages are sent and received. The class layout is as follows:
class WatcherDispatcher : public Dispatcher {  using WatchSet = std::set<const Watch*>;  base::Lock lock_;  bool armed_ = false;  bool closed_ = false;  base::flat_map<uintptr_t, scoped_refptr<Watch>> watches_;  base::flat_map<Dispatcher*, scoped_refptr<Watch>> watched_handles_;  WatchSet ready_watches_;  const Watch* last_watch_to_block_arming_ = nullptr;};
class Watch : public base::RefCountedThreadSafe<Watch> {  const scoped_refptr<WatcherDispatcher> watcher_;  const scoped_refptr<Dispatcher> dispatcher_;  const uintptr_t context_;  const MojoHandleSignals signals_;  const MojoTriggerCondition condition_;  MojoResult last_known_result_ = MOJO_RESULT_UNKNOWN;  MojoHandleSignalsState last_known_signals_state_ = {0, 0};  base::Lock notification_lock_;  bool is_cancelled_ = false;};
MojoResult WatcherDispatcher::Close() {  // We swap out all the watched handle information onto the stack so we can  // call into their dispatchers without our own lock held.  base::flat_map<uintptr_t, scoped_refptr<Watch>> watches;  {    base::AutoLock lock(lock_);    if (closed_)      return MOJO_RESULT_INVALID_ARGUMENT;    closed_ = true;    std::swap(watches, watches_);    watched_handles_.clear();  }
  // Remove all refs from our watched dispatchers and fire cancellations.  for (auto& entry : watches) {    entry.second->dispatcher()->RemoveWatcherRef(this, entry.first);    entry.second->Cancel();  }
  return MOJO_RESULT_OK;}
std::flat_map is actually backed by std::vector and watched_handles_ contains only one element most of the time, which takes exactly 16 bytes. This means we can overwrite a Watch pointer!
The size of the Watch class is relatively large — 104 bytes — and because of tcmalloc we can only target objects of a similar size for the partial overwrite. Furthermore, the target object should contain valid pointers at certain offsets to survive a call of a Watch method. Unfortunately, the network process doesn’t seem to contain a class that would meet the above requirements for a straightforward type-confusion.
We can take advantage of the fact that Watch is a reference-counted class though. The idea is to spray a lot of Watch-sized buffers, which tcmalloc will place next to the actual Watch object, and hope that scoped_refptr with the overwritten least significant byte will point to one of our buffers. The buffer should have the first 64-bit word, i.e. the fake reference counter, set to 1 and the rest set to 0. In that case, a call to WatcherDispatcher::Close, which frees the scoped_refptr, will trigger the deletion of our fake Watch, the destructor will finish gracefully, and the buffer will get freed.
If our buffer is scheduled to be sent to the attacker’s server or back to the renderer process, this will leak tcmalloc’s masked freelist pointers or, even better, some useful pointers if we managed to allocate something else there in the meantime. So, what we need now is the ability to create such buffers in the network process and delay sending them until the corruption has occurred.
Turns out the network process in Chrome is also responsible for handling WebSocket connections. What’s important is that WebSocket is a low overhead protocol, and it allows transferring binary data. If we make the receiving end of the connection sufficiently slow and send enough data to fill up the OS socket send buffer until the point where TCPClientSocket::Write becomes an "asynchronous" operation, subsequent calls to WebSocket::send will result in raw frame data being stored as IOBuffer objects with just two extra 32-byte allocations on each call. Moreover, we can control the lifetime of the buffers by modifying the delay on the receiving side.
Looks like we just found a near-perfect heap spraying primitive! It has one weakness though — it’s not possible to free an individual buffer. All frames tied to a connection get freed at once either when the current batch is sent or when the connection is torn down. We obviously can’t have a WebSocket connection per spray object, and each of the above operations induces a lot of undesired "noise" in the heap. However, let’s put it aside for a moment.
The following is the outline of the method:



Unfortunately, watched_handles_ quickly proved to be a suboptimal target. Some of its drawbacks are:
  • There are actually two flat_map members, but we can only use one of them since corrupting watched_handles_ will immediately trigger a crash during the RemoveWatcherRef virtual method call.
  • Each WatcherDispatcher allocation triggers a lot of "noise" in the size classes we care about.
  • There are 16 (= 256 / GCD(112, 256)) possible values for the LSB of a pointer in the Watch size class, most of which won’t even point to the beginning of an object.

While we were able to leak some data using this approach, its success rate was rather upsetting. The approach itself seemed reasonable, but we had to find a more "convenient" container to overwrite.WebSocketFrameIt’s time to take a closer look at how sending a WebSocket frame is implemented.
class NET_EXPORT WebSocketChannel {[...]  std::unique_ptr<SendBuffer> data_being_sent_;  // Data that is queued up to write after the current write completes.  // Only non-NULL when such data actually exists.  std::unique_ptr<SendBuffer> data_to_send_next_;[...]};
class WebSocketChannel::SendBuffer {  std::vector<std::unique_ptr<WebSocketFrame>> frames_;  uint64_t total_bytes_;};
struct NET_EXPORT WebSocketFrameHeader {  typedef int OpCode;
  bool final;  bool reserved1;  bool reserved2;  bool reserved3;  OpCode opcode;  bool masked;  uint64_t payload_length;};
struct NET_EXPORT_PRIVATE WebSocketFrame {  WebSocketFrameHeader header;  scoped_refptr<IOBuffer> data;};
ChannelState WebSocketChannel::SendFrameInternal(    bool fin,    WebSocketFrameHeader::OpCode op_code,    scoped_refptr<IOBuffer> buffer,    uint64_t size) {[...]  if (data_being_sent_) {    // Either the link to the WebSocket server is saturated, or several     // messages are being sent in a batch.    if (!data_to_send_next_)      data_to_send_next_ = std::make_unique<SendBuffer>();    data_to_send_next_->AddFrame(std::move(frame));    return CHANNEL_ALIVE;  }
  data_being_sent_ = std::make_unique<SendBuffer>();  data_being_sent_->AddFrame(std::move(frame));  return WriteFrames();}
WebSocketChannel employs two separate SendBuffer objects to store outgoing frames. When the connection is saturated, new frames go into data_to_send_next_. And, since the buffers are backed by an std::vector<std::unique_ptr<...>>, it can also become a target for overwriting! However, we need to figure out precisely the amount of data that has to be sent before the connection becomes saturated, otherwise data_to_send_next_’s buffer will quickly become too large to fit in the 16-byte slot. This value, which is tied to the FRAMES_ENOUGH_TO_FILL_BUFFER constant in the exploit, depends on both the network and system configuration. In theory, the exploit could calculate the value automatically; we just did it manually though for the "localhost" and "same LAN" cases. Also, to make the saturation process more reliable, the SO_RCVBUF option for the WebSocket server socket has to be changed to a relatively small value,  and data compression has to be disabled.
As mentioned above, our heap spray technique makes two extra 32-byte allocations for each "desired" allocation. Unfortunately, WebSocketFrame, a pointer to which we’re planning to overwrite, is exactly 32 bytes in size. That means unless we use some additional heap manipulation tricks, only 1/3 of all objects produced during the heap spray will be of the right type. On the other hand, there are half as many possible values for the LSB in this size class compared to the Watch one, with a much higher chance of pointing to the beginning of a proper allocation. What’s even more important is, unlike WatcherDispatcher, WebSocket::Send won’t trigger any allocations in the 16-byte arena apart from resizing the std::vector that we’re targeting, so the heap spray in that size class should be clean and tidy. On balance, this makes data_to_send_next_ a better target.Allocation PatternsFor lack of a more robust alternative, we have to use WebSocket::Send as the default heap manipulation tool. It’s responsible for at least:
  • Spraying with 32-byte buffers, to one of which we want to overwrite the WebSocketFrame pointer.
  • Inserting the target vector entry and creating the tied WebSocketFrame.
  • Allocating an IOBuffer object in place of the freed buffer.


The objects shown in red above are "unwanted" allocations. Each of those will negatively affect the reliability of the exploit, but we have no way of avoiding them so far and just have to hope that with the unlimited amount of retries it won’t matter much.InfoleakOnce we can fairly reliably overwrite the WebSocketFrame pointer, we’ve turned our slightly annoying primitive that only let us corrupt objects in the 16-byte bucket into a new primitive allowing us to free an allocation from the 32-byte bucket instead. Since data_to_send_next_ uses std::unique_ptr instead of scoped_refptr, we also don’t have to care about making up a fake reference counter. The only requirement for the free’d fake WebSocketFrame is that its data pointer should be null.
We can use this primitive to build quite a useful infoleak that will give us both the location of the Chrome binary in memory, and the location of data that we can control on the heap, giving us all the information that’s necessary to complete our exploit.
One of the advantages of using WebSockets in our heap manipulation is that the browser is going to send the data stored in these frames to the server (once the socket is unblocked), and so if we can use this free to free the backing store for an IOBuffer that’s already queued to be sent, we will be able to leak the new contents of that allocation. Additionally, since this size class matches the allocation size of the IOBuffer objects, we can replace the free backing store with a new IOBuffer object. This gives us a leak of the IOBuffer vtable pointer, the first piece of information that we need.
However, the IOBuffer object also includes a pointer to its backing store — which is a heap allocation of a size that we control. If we ensure that this is in a size class that won’t interfere with the rest of our heap manipulation, we can leak this pointer now, and later on in the exploit we can free this allocation and reuse it for something more useful.

Code ExecutionAssuming that we can reuse the larger allocation that we leaked the address of, we could certainly be forgiven for thinking that we’re almost done here — we know where we can write some data, we know what data we should write there, and we have the relatively powerful 32-byte free primitive we built for the infoleak.
Unfortunately, as mentioned above, we don’t really have great primitives for just allocating IOBuffers or WebSocketFrames individually; good things come in pairs! While for the infoleak we didn’t have much flexibility (we needed to free an IOBuffer backing store, and we needed to replace it with an IOBuffer object), for the next stage in our exploit we have a few options to try and increase our chances of success.
Since we’re not interested in freeing an IOBuffer backing store any more, we can move those allocations into a different size class, so that we now have only three different object types coming from the 32-byte bucket: WebSocketFrame, IOBuffer, and SendBuffer. If we can spray perfectly, then we should be able to arrange to have 3 pairs of "target IOBuffer" and "target WebSocketFrame" for each "victim WebSocketFrame". This means that when we corrupt the pointer to the "victim WebSocketFrame" by triggering the vulnerability a second time, we have an equal probability of freeing either an IOBuffer or a WebSocketFrame.
By crafting our replacement object carefully, we can take advantage of both possibilities. We’re going to gain control of execution during the destructor call for either the WebSocketFrame or the IOBuffer. The only field that really matters in the WebSocketFrame is the data pointer, which needs to point to an IOBuffer object. Since this corresponds to the padding bytes at the end of the IOBuffer object, we can create a replacement object that can fill the space of either a freed IOBuffer or a freed WebSocketFrame.
When the replacement object is then freed, if we replaced an IOBuffer then when decrementing ref_count_ results in 0, we’ll get a virtual call through our fake vtable — if we instead replaced a WebSocketFrame, then the WebSocketFrame will release its data member, which we’ve pointed to another fake IOBuffer, which will again result in a virtual call through our fake vtable.
Throughout all of the above, we’ve been ignoring a minor detail — which thanks to our careful prior preparation will indeed turn out to be fairly minor — we need to get our second fake IOBuffer and our fake vtable into memory at a known address. We unfortunately can’t release the allocation that we leaked the address of earlier, since the IOBuffer object that we leaked will have been freed (as though it was the backing store of the IOBuffer sent back to us).
This isn’t a major issue though; we can choose for those larger allocations to go into a "quiet" bucket size. If we prepare that bucket size in advance with alternating buffers from two different websockets, then we can release one of those websockets to ensure that the address we leak will be adjacent to a buffer from the second websocket. After we’ve leaked the address, we can then release the second websocket and replace the contents of this adjacent buffer with our fake objects.


In summary, we use the backing data of a larger IOBuffer at a known address to write controlled data into memory. This contains a fake IOBuffer vtable, together with our code-reuse payload and a second fake IOBuffer. We can then trigger the vulnerability again, this time causing the use-after-free of either an IOBuffer object or a WebSocketFrame object, both of which will use pointers into the larger IOBuffer backing data that’s (now) at a known address.
When the corrupted objects are freed, our payload is run and our work here is done… almost…Recap: Component breakdownAt this point, we have quite a few moving parts, so for those of you who want to dive into the source code for the exploit here’s a quick breakdown:
  • serv.py — a custom webserver that will just handle the request for the image file, and return the appropriate sequence of responses to trigger the vulnerability.
  • pywebsocket.diff — a few patches to pywebsocket which remove compression and set SO_RCVBUF for the websocket server.
  • get_chrome_offsets.py — a script that will attach to the running browser and collect all of the necessary offsets for the payload. This requires frida to be installed.
  • CrossThreadSleep.py — this implements a basic sleepable wait primitive that is used to sleep individual threads in the websocket server and wake them from other threads.
  • exploit/echo_wsh.py — a websocket handler for pywebsocket that handles several message types that will cause either a timed delay or a wakeable delay that allow the  socket-buffering manipulation that we need.
  • exploit/wake_up_wsh.py — a websocket handler for pywebsocket that handles several control messages to wake sleeping "echo" sockets.
  • exploit/exploit.html — the javascript code that is used to implement the exploit logic.

We’ve also provided some scripts to make it easier for readers to get a working Chromium build that’s vulnerable to the issue, and to get the rest of the environment set up correctly:
  • get_chromium.sh — a shell script that will check out and configure a vulnerable Chromium release.
  • get_pywebsocket.sh — a shell script that will download and patch pywebsocket for the exploit server.
  • run_pywebsocket.sh — a shell script to start the exploit server. You need to separately run the serv.py script.

The exploit server runs on two ports: exploit.html is served up by the websocket server, and the second server serves the image used to trigger the vulnerability.Chapter 5. More reliable exploitAt this point we have an exploit that should work sometimes. It creates a lot of "junk" allocations during the heap spray, and we’ve made a lot of assumptions about hitting the correct object types, so let’s evaluate the probability of a single exploit run succeeding:


Given that one run takes about a minute, this is definitely not a satisfactory result, even with the virtually unlimited number of retries that we have.Cookie-based heap groomingTo make our heap spray more reliable we need a way to separate "good" and "bad" 32-byte allocations. As the reader might have already noticed, precisely manipulating the heap in the network process is not a trivial task, especially from the position of a non-compromised renderer. 
One of the features related to networking that we haven’t considered yet is HTTP cookies. Somewhat surprisingly, the network process is responsible for not only sending and receiving cookies, but also for storing them in memory and saving them to disk. Since there exists the JavaScript API for cookie operations, and the operations don’t seem to be terribly complex, we might use the API to build additional heap manipulation primitives.
After some experimentation, we’ve constructed three new heap manipulation primitives:


To be honest, they are much less straightforward than we originally expected. For example, here’s the output of a Frida script that tracks the 32-byte heap arena state transitions during the execution of the free_slot() method, which, as its name suggests, just appends a new entry to the 32-byte freelist.
NoOperationSizeAddress1alloc240x17df6f7c71802alloc320x17df6f7d5bc03free320x17df6f7385c04free240x17df6f7386405alloc240x17df6f7386406alloc320x17df6f7385c07free320x17df6f7606008alloc240x17df6f7606009free240x17df6f7c718010alloc320x17df6f7c718011free320x17df6f7c718012free320x17df6f7385c013alloc240x17df6f7385c014free320x17df6f7d5bc015free240x17df6f73864016free240x17df6f76060017alloc240x17df6f76060018alloc240x17df6f73864019free240x17df6f7385c0
As you can see, it’s perhaps not the simple, clean and tidy primitive we’d like to have, but it does what we need it to!
By carefully integrating the new methods into the exploit, we can get rid of all the unwanted allocations in the heap spray memory area. The diagram depicting the updated infoleak spray looks as follows:


Now, in the worst case, we’ll overwrite the LSB of the WebSocketFrame pointer with the same value, which will have no effect. This gives us 7/8 instead of 2/8 as the first multiplier of our "reliability" formula. The same applies with regard to other parts of the exploit. As a result, the above total probability should be bumped up to 0.75 per run.
Again, this method comes with several limitations, for example:
  • The number of cookies a website can have is capped at 180 in Chrome.
  • Every 512th cookie-related operation triggers flushing the in-memory cookie store to the disk, which ruins any heap spray.
  • There’s also an automatic flushing every 30 seconds.
  • The cookie store for our website should be in a particular state before each run of the spray, otherwise the manipulation methods might produce unreliable results.

Luckily, our exploit can be designed to deal with most of the above restrictions automatically. The heap spray has to be split into tiny chunks, which can be processed separately, though. Because of that, and because we’ve reached the limit of the spray size tied to the maximum number of connected WebSockets, the actual exploit ends up to be less reliable. However, paired with the ability to restart the network process, it seems to usually take only 2-3 tries before succeeding, which is a whole lot better than the previous version.Chapter 6. ConclusionThe servicification work that Chrome has been doing has had several interesting impacts on exploitation of this kind of bug. First, moving this code into a separate service process (the network service) has had a substantial impact on the difficulty of finding reliable heap-grooming primitives. This means that even without a proper sandbox, the network service implementation in Chrome means that the network stack is now a slightly harder target than it was before! Service processes implementing a relatively small number of features are inherently harder targets for exploitation than larger monolithic components; they have a reduced number of available weird-machines, and this reduces attacker choice. We hadn’t really thought about this, so this was an interesting surprise.

Second (and this is definitely a recurring theme at the moment), restarting service processes aids exploitation. For an exploit developer, knowing that you can have as many tries as you need takes a lot of pressure off — you have a lot more freedom to create and use unreliable primitives. This is even more true on platforms that don’t have per-process randomness — we chose Linux for this so that we’d need to construct a stable infoleak — on other platforms exploitation may be easier.
Given the additional complexity and reliability concerns, it doesn’t seem very likely that this kind of bug is being used by attackers at the moment. The "traditional" browser exploitation chain of a renderer bug and an OS/kernel privilege escalation is both simpler to write and easier to maintain. However, it’s not unrealistic to think that if those chains start to become scarce, attackers might move to this kind of vulnerability — and we’ve demonstrated that it’s possible to exploit such an issue with a reasonable level of reliability. This means that sandboxing even of these less-visible attack surfaces is also important to the overall security of the browser.
Kategorie: Hacking & Security
Syndikovat obsah