diff --git a/cve/openssl/2022/CVE-2022-3602/README.md b/cve/openssl/2022/CVE-2022-3602/README.md new file mode 100644 index 0000000000000000000000000000000000000000..4b47bb6480b09b545cab5853bfc16afe3f81c879 --- /dev/null +++ b/cve/openssl/2022/CVE-2022-3602/README.md @@ -0,0 +1,39 @@ +# CVE-2022-3602 +This is a detection script which will determine whether client authentication is required by the SSL server, +in which case servers based on OpenSSL 3.0.0 to 3.0.6 will be vulnerable to both CVE-2022-3602 and CVE-2022-3786 + +## Prerequisite's +- python3 +- pip install -r requirements.txt + +## Usage +``` +usage: openssl_cert_detector.py [-h] [-t TARGET] [-T TARGETS] + +optional arguments: + -h, --help show this help message and exit + -t TARGET, --target TARGET + Single IP with port separate by colon. Example: -t 192.168.0.3:3000 + -T TARGETS, --targets TARGETS + List of IP and port separate by colon and separated by new line in text file +``` + +### Example 1: +To check for openssl vulnerability on single ip and port + +``` +python openssl_cert_detector.py -t 192.168.0.3:3000 +``` + +### Example 2: + +To check for openssl vulnerability on list of ip and its port in separated by new line in text file + +``` +python openssl_cert_detector.py -T check.txt +``` + +## References +- https://github.com/colmmacc/CVE-2022-3602 +- https://github.com/DataDog/security-labs-pocs/tree/main/proof-of-concept-exploits/openssl-punycode-vulnerability +- https://github.com/jfrog/jfrog-openssl-tools \ No newline at end of file diff --git a/cve/openssl/2022/CVE-2022-3602/openssl_cert_detector.py b/cve/openssl/2022/CVE-2022-3602/openssl_cert_detector.py new file mode 100644 index 0000000000000000000000000000000000000000..e898422962e9f3cc898d77154b63d66e0d1f94d1 --- /dev/null +++ b/cve/openssl/2022/CVE-2022-3602/openssl_cert_detector.py @@ -0,0 +1,105 @@ +import socket +import ssl +import sys +import warnings +import enum +import argparse +import ipaddress + +warnings.filterwarnings("ignore", category=DeprecationWarning) + + +TIMEOUT = 0.2 + + +class OpSll(enum.Enum): + Error = -1 + Cert_not_required = 0 + Cert_required = 1 + +def fileload(filename): + # This get input from text file and converts to list + f= open(filename, "r") + content=f.read() + f.close() + content=content.split("\n") + while("" in content): + content.remove("") + return content + +def Server_Connection_Status(host, port): + client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + client.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + client = ssl.wrap_socket(client) + + try: + client.connect((host, port)) + except Exception as e: + print(e) + return OpSll.Error + + client.settimeout(TIMEOUT) + try: + client.read(1) + + except ssl.SSLError as err: + if "CERTIFICATE_REQUIRED" in str(err): + return OpSll.Cert_required + except TimeoutError: + return OpSll.Cert_not_required + + except Exception as e: + return OpSll.Error + + return OpSll.Cert_not_required + + +def reporting(host, port, status): + print('[*] Host information: {0}:{1}'.format(host,port)) + if OpSll.Cert_not_required == status: + print('[+] Status: {0}'.format('Not Vulnerable')) + print('[+] Reason: {0}'.format('Client certificate not required!')) + + if OpSll.Cert_required == status: + print('[+] Status: {0}'.format('Vulnerable')) + print('[+] Reason: {0}'.format('Client certificate is required!')) + + if OpSll.Error == status: + print('[-] Status: {0}'.format('Unable to connect')) + print('[-] Reason: {0}'.format('Either Host is down or crashed!')) + + + +# adding argparse modules +parser = argparse.ArgumentParser() +parser.add_argument("-t","--target", help="Single IP with port separate by colon. Example: -t 192.168.0.3:3000",type=str) +parser.add_argument("-T","--targets", help="List of IP and port separate by colon ssin text file",type=str) +args = parser.parse_args() +if len(sys.argv) < 2: + parser.print_help() + sys.exit(1) + + +if __name__ == "__main__": + print('[!] CVE: CVE-2022-3602, CVE-2022-3786') + print('[!] This script will detect whether openssl \n[!] server is vulnerable or not based on') + print('[!] whether certificated is required by server or not\n') + + info=dict() + + if args.target: + ip_list=[args.target] + + if args.targets: + ip_list=fileload(args.targets) + + if len(ip_list)==0: + print("Required argument:\n-t or -T Single Ip/file with ip list") + sys.exit(1) + + for host in ip_list: + host=host.split(":") + res = Server_Connection_Status(host[0],int(host[1])) + reporting(host[0],int(host[1]), res) + print('\n') + \ No newline at end of file diff --git a/cve/openssl/2022/CVE-2022-3602/requirements.txt b/cve/openssl/2022/CVE-2022-3602/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef39c4b52bfc365b5a1eaa6bf5140db8be3950f9 --- /dev/null +++ b/cve/openssl/2022/CVE-2022-3602/requirements.txt @@ -0,0 +1,2 @@ +argparse +ipaddress \ No newline at end of file diff --git a/cve/openssl/2022/yaml/CVE-2022-3602.yaml b/cve/openssl/2022/yaml/CVE-2022-3602.yaml new file mode 100644 index 0000000000000000000000000000000000000000..90d08abac7afc118849ac465e875ece9feee193f --- /dev/null +++ b/cve/openssl/2022/yaml/CVE-2022-3602.yaml @@ -0,0 +1,27 @@ +id: CVE-2022-3602 +source: + https://github.com/cybersecurityworks553/CVE-2022-3602-and-CVE-2022-3786 +info: + name: Openssl是一个功能极其强大的命令行工具,可以用来完成公钥体系及HTTPS相关的很多任务。 + severity: high + description: | + Openssl 3.0.x版本在X.509证书验证过程中存在4个字节的邮箱地址缓存溢出问题,可能导致内存损坏,攻击者可能能够在执行计算的计算机上触发远程代码执行。 + scope-of-influence: + Openssl 3.0.0 + Openssl 3.0.1 + Openssl 3.0.2 + Openssl 3.0.3 + Openssl 3.0.4 + Openssl 3.0.5 + Openssl 3.0.6 + reference: + - https://www.openssl.org/blog/blog/2022/11/01/email-address-overflows/ + - https://nvd.nist.gov/vuln/detail/cve-2022-3602 + classification: + cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H + cvss-score: 7.5 + cve-id: CVE-2022-3602 + cwe-id: CWE-120 + cnvd-id: None + kve-id: None + tags: 缓存溢出,BOF,拒绝服务,DoS,cve2022,RCE,远程代码执行 \ No newline at end of file diff --git a/openkylin_list.yaml b/openkylin_list.yaml index 323454b7beb22c218ff26e79627829ece37c6ab0..86115046949de172c9e71798a22ac9143248d536 100644 --- a/openkylin_list.yaml +++ b/openkylin_list.yaml @@ -45,6 +45,7 @@ cve: openssl: - CVE-2022-1292 - CVE-2022-2274 + - CVE-2022-3602 - CVE-2023-25136 libxml2: - CVE-2020-24977