Posted onEdited onInctfDisqus: Word count in article: 347Reading time ≈1 mins.
A concise guide to common operations and tools within the Radare2
framework.
rax2 - Base Conversion
Used for converting between various numerical bases and formats.
Command Line
1 2 3
rax2 0x28 # Hex to decimal rax2 40 # Decimal to hex rax2 -h # Show help
Internal (within r2)
Use the ? command to evaluate expressions or convert
values.
1 2
[0x00000000]> ? 0x28 # Convert 0x28 to all formats [0x00000000]> ? 3+4 # Evaluate basic math
rabin2 - Binary Information
Extracts information from executable files (imports, exports,
strings, etc.).
Common Commands
1 2 3 4 5
rabin2 -I file # General binary info (arch, OS, bits, etc.) rabin2 -z file # List strings in data sections rabin2 -zz file # List strings in the entire binary rabin2 -i file # List imports (linked libraries/functions) rabin2 -e file # List entry points
radare2 (r2) - Core
Interactive Tool
The main interface for disassembly, analysis, and debugging.
Startup
1 2 3
r2 -A file # Open file and run analysis (aaa) r2 -w file # Open file in write mode r2 file # Open without any analysis
Navigation (s)
1 2 3
s 0x400500 # Seek to specific address s main # Seek to 'main' symbol s - # Seek back to previous location
Analysis (a)
1 2 3
aa # Basic analysis aaa # Full analysis (including functions and symbols) afl # List all analyzed functions
Disassembly & Printing
(p)
1 2 3 4 5
pdf # Print Disassembly of current Function pdf @ main # Print Disassembly of specific function pd 10 # Print 10 lines of Disassembly pD 32 # Print 32 bytes of Disassembly px 64 # Print 64 bytes of Hexdump
Writing (w)
Note: Requires opening r2 with -w.
1 2
wx 909090 # Write hex bytes (NOPs) wa nop # Assemble and write a single instruction
Visual Modes (v,
V)
1 2 3 4 5
v # Open visual panels V # Enter visual mode VV # Enter visual graph mode v test # Load saved layout 'test' v= test # Save current layout as 'test'
rasm2 - Assembler &
Disassembler
Quickly assemble or disassemble instructions.
Usage
1 2 3 4 5
# Assemble an instruction (x86, 64-bit) rasm2 -a x86 -b 64 "nop"
# Disassemble hex code (machine code) rasm2 -a x86 -b 64 -d "90"
Posted onEdited onInctfDisqus: Word count in article: 135Reading time ≈1 mins.
challenges
Game 01
Code Analysis
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
<% str = Request("str")
If not str = "" Then result = Replace(str,"a","aad") result = Replace(result,"i","in") result1 = Mid(result,2,2) result2 = Mid(result,4,6) result = result1 & result2 Response.write result If result = "admin" Then pw = "????????" End if End if %>
Replace(str, "a", "aad"): Replaces every 'a' with
'aad'.
Replace(result, "i", "in"): Replaces every 'i' with
'in'.
Mid(result, 2, 2): Extracts 2 characters starting from
the 2nd index.
Mid(result, 4, 6): Extracts up to 6 characters starting
from the 4th index.
The goal is to make the final concatenated result equal
to admin.
If we input ami: - a -> aad
- i -> in - Intermediate result:
aadmin - result1 =
Mid("aadmin", 2, 2) = ad -
result2 = Mid("aadmin", 4, 6) =
min - result = ad +
min = admin
Posted onEdited onInctfDisqus: Word count in article: 101Reading time ≈1 mins.
challenges
Game 02
Analysis
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
<script> functionchk_form() { var id = document.web02.id.value; var pw = document.web02.pw.value; if (id == pw) { alert("You can't join! Try again"); document.web02.id.focus(); document.web02.id.value = ""; document.web02.pw.value = ""; } else { document.web02.submit(); } } </script> <!-- Hint : Join / id = pw --> <!-- M@de by 2theT0P -->
The script prevents the form from being submitted if the
id is equal to the pw. However, the hint
explicitly states that for the Join challenge, we need
id = pw.
Bypass
Intercept the request with a proxy (like Burp Suite or Zaproxy) or
use the browser's Network tab to replay a modified request.
functionPASS(n) { var result = ""; var start = true; for (var i = 32; i > 0; ) { i -= 4; var digit = (n >> i) & 0xf; if (!start || digit != 0) { start = false; result += digitArray[digit]; } } return result == "" ? "0" : result; }