Ep. 5 - An S-Box in Everything
Show Notes
COVID KIT RE
Product documentation - https://www.nordicsemi.com/Products/nRF52810
Power Glitch - https://github.com/atc1441/ESP32_nRF52_SWD?tab=readme-ov-file
SWD - https://plaes.org/technotes/embedded-systems/ftdi-ft232h-for-hardware-hacking/
General good info about the chip - https://www.utmel.com/components/nrf52810-multiprotocol-soc-datasheet-pinout-schematic?id=538
The datasheet for the FET that used to glitch - https://alltransistors.com/adv/pdfview.php?doc=vs6038ad.pdf&dire=_cn_vanguard
CYB CTF
LINKS
GDB COMMANDS
Basic Navigation and Execution Control
run (or r): Starts the program (use run [args] to pass arguments).
continue (or c): Resumes execution until the next breakpoint or signal.
next (or n): Steps to the next line, skipping over function calls.
step (or s): Steps into function calls, allowing you to debug within them.
finish: Continues execution until the current function returns.
until [location]: Runs until it reaches the specified location or the end of the current loop.
Breakpoints and Watchpoints
break [location]: Sets a breakpoint at a specified line, function, or address (e.g., break main or break 42).
break if [condition]: Sets a conditional breakpoint (e.g., break 42 if x > 5).
watch [expression]: Sets a watchpoint to stop execution when the value of an expression changes.
delete [breakpoint number]: Removes a breakpoint.
disable / enable [breakpoint number]: Temporarily disables or re-enables a breakpoint.
Inspecting Variables and Memory
print [expression] (or p): Prints the value of an expression or variable (e.g., print my_var).
x/[format] [address]: Examines memory at a specific address with various formats:
x/10i $pc: Shows the next 10 instructions from the program counter.
x/10x $sp: Displays 10 words of memory in hexadecimal from the stack pointer.
x/4s [address]: Shows four null-terminated strings at the given address.
info registers: Lists all register values.
info locals: Displays the values of local variables in the current stack frame.
ptype [variable]: Shows the data type of a variable.
whatis [variable]: Similar to ptype, shows the type of a variable.
Stack and Frame Navigation
backtrace (or bt): Displays the call stack; useful for understanding the current execution path.
frame [frame number]: Switches to a specific frame in the call stack.
up / down: Navigates up or down the call stack by one frame.
Program State Information
info breakpoints: Lists all breakpoints and watchpoints, including their statuses.
info functions: Lists all the functions in the program.
info sources: Displays all source files that are part of the program.
info threads: Shows all threads running in the program, with details.
info sharedlibrary: Lists all shared libraries loaded by the program.
Modifying Program State
set var [variable] = [value]: Changes the value of a variable (e.g., set var x = 42).
call [function]([arguments]): Calls a function with specified arguments directly from GDB (e.g., call my_func(1, 2)).
Logging and Scripting
set logging on: Enables logging of GDB output to a file (use set logging file [filename] to specify the file).
source [filename]: Executes GDB commands from a file, useful for scripting and automating debug sessions.
define [command-name]: Lets you define a custom GDB command with a series of actions.
set logging off: Stops logging.
Disassembly and Assembly Inspection
disassemble [function]: Disassembles a specific function, showing its assembly code.
layout asm: Switches to an assembly view in the TUI mode, which can help visualize the code flow in assembly.
Other Useful Commands
quit: Exits GDB.
help [command]: Provides help for a specific command.
shell [command]: Runs a shell command directly from GDB (e.g., shell ls).
start: Runs the program and stops at the first line in main, which is useful for debugging from the beginning.
continue with an argument: Continue until it stops the specified number of times (e.g., continue 5).