Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions Binary Exploitation/BeeChat/src/compile.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#!/bin/bash
# This script compiles chall.c with full security mitigations.
GCC_FLAGS=(
"-fPIE" # Position-Independent Executable
"-pie" # Link as PIE
"-fstack-protector-all" # Enable stack canaries for all functions
"-Wl,-z,relro,-z,now" # Full RELRO
"-Wl,-z,noexecstack" # Non-executable stack
)
gcc -o chall chall.c "${GCC_FLAGS[@]}"
echo "[+] Compilation complete! Output file: chall_secure"
echo "[*] Note: The binary is linked against your system's default libc."
echo "[*] To link against glibc-2.27, run this script inside the Ubuntu 18.04 Docker container."
#!/bin/bash

# This script compiles chall.c with full security mitigations.

GCC_FLAGS=(
"-fPIE" # Position-Independent Executable
"-pie" # Link as PIE
"-fstack-protector-all" # Enable stack canaries for all functions
"-Wl,-z,relro,-z,now" # Full RELRO
"-Wl,-z,noexecstack" # Non-executable stack
)

gcc -o chall chall.c "${GCC_FLAGS[@]}"

echo "[+] Compilation complete! Output file: chall_secure"
echo "[*] Note: The binary is linked against your system's default libc."
echo "[*] To link against glibc-2.27, run this script inside the Ubuntu 18.04 Docker container."
20 changes: 10 additions & 10 deletions Binary Exploitation/BeeChat/src/extract.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
docker system prune
docker build -t chall-builder .
docker create --name temp-container chall-builder
docker cp temp-container:/app/chall .
docker cp temp-container:/lib/x86_64-linux-gnu/libc-2.27.so .
docker cp temp-container:/lib/x86_64-linux-gnu/ld-2.27.so .
docker rm temp-container
mv libc-2.27.so libc.so.6
mv ld-2.27.so ld-linux-x86-64.so.2
docker system prune
docker build -t chall-builder .
docker create --name temp-container chall-builder
docker cp temp-container:/app/chall .
docker cp temp-container:/lib/x86_64-linux-gnu/libc-2.27.so .
docker cp temp-container:/lib/x86_64-linux-gnu/ld-2.27.so .
docker rm temp-container

mv libc-2.27.so libc.so.6
mv ld-2.27.so ld-linux-x86-64.so.2
32 changes: 16 additions & 16 deletions Binary Exploitation/BeeChat/src/start.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#!/usr/bin/env bash
set -euxo pipefail
cd "$(dirname "$0")"
export COMPOSE_PROJECT_NAME=beechat
if docker compose version >/dev/null 2>&1; then
DC="docker compose"
elif command -v docker-compose >/dev/null; then
DC="docker-compose"
else
echo "Docker Compose not found" >&2
exit 127
fi
$DC down -v --rmi all --remove-orphans || true
$DC pull || true
$DC build --pull
$DC up -d --force-recreate --renew-anon-volumes
#!/usr/bin/env bash
set -euxo pipefail
cd "$(dirname "$0")"
export COMPOSE_PROJECT_NAME=beechat
if docker compose version >/dev/null 2>&1; then
DC="docker compose"
elif command -v docker-compose >/dev/null; then
DC="docker-compose"
else
echo "Docker Compose not found" >&2
exit 127
fi
$DC down -v --rmi all --remove-orphans || true
$DC pull || true
$DC build --pull
$DC up -d --force-recreate --renew-anon-volumes