The Information (i) Module displays information about the binary. We extensively use this module when performing static analysis.
We will collect the following information using this module:
These pieces are instrumental to understanding the binary, the underlying source code, and the protections in place.
The Information Module has identical functionality to the rabin2 library. More information on rabin2 can be found here.
i?Usage: i Get info from opened file (see rabin2's manpage)Output mode:| '*' output in radare commands| 'j' output in json| 'q' simple quiet outputActions:| i|ij show info of current file (in JSON)| iA list archs| ia show all info (imports, exports, sections..)| ib reload the current buffer for setting of the bin (use once only)| ic List classes, methods and fields (icj for json)| ic. show class and method name in current seek| ic-[klass.method] delete given klass or klass.name| ic+[klass.method] add new symbol in current seek for a given klass and method name| icc List classes, methods and fields in Header Format| icg [str] List classes as agn/age commands to create class hierarchy graphs (matches str if provided)| icq List classes, in quiet mode (just the classname)| icqq List classes, in quieter mode (only show non-system classnames)| icl Show addresses of class and it methods, without names| ics Show class symbols in an easy to parse format| iC[j] show signature info (entitlements, ...)| id[?] show DWARF source lines information| iD lang sym demangle symbolname for given language| ie entrypoint| iee show Entry and Exit (preinit, init and fini)| iE exports (global symbols)| iE,[table-query] exported symbols using the table queryImports and exports are useful for understanding the function calls, external libraries imported, and the overall functionality of the binary.
Imports and exports are important for understanding the libraries imported into the binary and the externally visible and usable functions.
Function imports are essential for understanding the library functions used in the binary. This provides a massive hint into the functionality of the binary. Use ii to list the imports.
ii[Imports]nth vaddr bind type lib name―――――――――――――――――――――――――――――――――――――1 0x08049040 GLOBAL FUNC __libc_start_main2 0x08049050 GLOBAL FUNC fflush3 0x08049060 GLOBAL FUNC gets4 0x08049070 GLOBAL FUNC puts5 0x08049080 GLOBAL FUNC system6 ---------- WEAK NOTYPE __gmon_start__7 ---------- GLOBAL OBJ stdoutUse iE to list the exports. This is useful for understanding the functions that are externally visible and usable. This is especially useful for understanding the functions that are called from other binaries.
iE[Exports]nth paddr vaddr bind type size lib name demangled――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――8 0x00002004 0x0804a004 GLOBAL OBJ 4 _IO_stdin_used19 0x000010e0 0x080490e0 GLOBAL FUNC 4 __x86.get_pc_thunk.bx23 ---------- 0x0804c028 GLOBAL NOTYPE 0 _edata24 0x00001258 0x08049258 GLOBAL FUNC 0 _fini25 0x00003020 0x0804c020 GLOBAL NOTYPE 0 __data_start29 0x00003024 0x0804c024 GLOBAL OBJ 0 __dso_handle30 0x00002004 0x0804a004 GLOBAL OBJ 4 _IO_stdin_used31 0x000011a6 0x080491a6 GLOBAL FUNC 73 win32 ---------- 0x0804c02c GLOBAL NOTYPE 0 _end33 0x000010d0 0x080490d0 GLOBAL FUNC 5 _dl_relocate_static_pie34 0x00001090 0x08049090 GLOBAL FUNC 49 _start35 0x00002000 0x0804a000 GLOBAL OBJ 4 _fp_hw37 ---------- 0x0804c028 GLOBAL NOTYPE 0 __bss_start38 0x0000123c 0x0804923c GLOBAL FUNC 24 main39 0x00001254 0x08049254 GLOBAL FUNC 0 __x86.get_pc_thunk.ax40 0x000011ef 0x080491ef GLOBAL FUNC 77 read_in41 ---------- 0x0804c028 GLOBAL OBJ 0 __TMC_END__42 0x00001000 0x08049000 GLOBAL FUNC 0 _initYou can use iI to get the summary information about the binary, which includes the security features.
iIarch x86baddr 0x8048000binsz 13864bintype elfbits 32canary falseinjprot falseclass ELF32compiler GCC: (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0crypto falseendian littlehavecode trueintrp /lib/ld-linux.so.2laddr 0x0lang clinenum truelsyms truemachine Intel 80386nx falseos linuxpic falserelocs truerelro partialrpath NONEsanitize falsestatic falsestripped falsesubsys linuxva trueThe most important security features listed here are:
canarypic (and baddr if PIE is enabled)nxrelrolang, endian, arch, bits, and osRadare2 supports using pipes. Therefore, you can pipe the output to grep to summarize the output.
rabin2 -I args | grep -E "canary|pic|nx|relro"canary falsenx falsepic falserelro partialSymbols and strings are vital information. Strings tell the story of the binary's functionality, and symbols are useful for understanding the variables and functions.
The iz submodule is responsible for finding strings. Based on the help pages for this submodule, we have the following options:
iz?| iz[?][j] strings in data sections (in JSON/Base64)| iz* print flags and comments r2 commands for all the strings| izz search for Strings in the whole binary| izz* same as iz* but exposing the strings of the whole binary| izzz dump Strings from whole binary to r2 shell (for huge files)| iz- [addr] purge string via bin.str.purgeThe most important two commands here are iz and izz. The other commands perform similar functions, but these two format strings in the most readable way.
iz[Strings]nth paddr vaddr len size section type string―――――――――――――――――――――――――――――――――――――――――――――――――――――――0 0x00002008 0x0804a008 9 10 .rodata ascii You lose!1 0x00002012 0x0804a012 12 13 .rodata ascii cat flag.txt2 0x0000201f 0x0804a01f 23 24 .rodata ascii Good luck winning here!Use the is command to list the available symbols.
is[Symbols]nth paddr vaddr bind type size lib name demangled―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――8 0x00002004 0x0804a004 GLOBAL OBJ 4 _IO_stdin_used1 ---------- 0x00000000 LOCAL FILE 0 crt1.o2 0x000001cc 0x080481cc LOCAL OBJ 32 __abi_tag3 ---------- 0x00000000 LOCAL FILE 0 crtstuff.c4 0x000010f0 0x080490f0 LOCAL FUNC 0 deregister_tm_clones5 0x00001130 0x08049130 LOCAL FUNC 0 register_tm_clones6 0x00001170 0x08049170 LOCAL FUNC 0 __do_global_dtors_aux7 ---------- 0x0804c028 LOCAL OBJ 1 completed.08 0x00002f0c 0x0804bf0c LOCAL OBJ 0 __do_global_dtors_aux_fini_array_entry9 0x000011a0 0x080491a0 LOCAL FUNC 0 frame_dummy10 0x00002f08 0x0804bf08 LOCAL OBJ 0 __frame_dummy_init_array_entry11 ---------- 0x00000000 LOCAL FILE 0 args.c12 ---------- 0x00000000 LOCAL FILE 0 crtstuff.c13 0x0000215c 0x0804a15c LOCAL OBJ 0 __FRAME_END__14 ---------- 0x00000000 LOCAL FILE 015 0x00002f10 0x0804bf10 LOCAL OBJ 0 _DYNAMIC16 0x00002038 0x0804a038 LOCAL NOTYPE 0 __GNU_EH_FRAME_HDR17 0x00003000 0x0804c000 LOCAL OBJ 0 _GLOBAL_OFFSET_TABLE_19 0x000010e0 0x080490e0 GLOBAL FUNC 4 __x86.get_pc_thunk.bx20 0x00003020 0x0804c020 WEAK NOTYPE 0 data_startTo get the list of variables, we need to filter for the objects in this list. We can do this using the ~ operator (the grep operator).
is~OBJ8 0x00002004 0x0804a004 GLOBAL OBJ 4 _IO_stdin_used2 0x000001cc 0x080481cc LOCAL OBJ 32 __abi_tag7 ---------- 0x0804c028 LOCAL OBJ 1 completed.08 0x00002f0c 0x0804bf0c LOCAL OBJ 0 __do_global_dtors_aux_fini_array_entry10 0x00002f08 0x0804bf08 LOCAL OBJ 0 __frame_dummy_init_array_entry13 0x0000215c 0x0804a15c LOCAL OBJ 0 __FRAME_END__15 0x00002f10 0x0804bf10 LOCAL OBJ 0 _DYNAMIC17 0x00003000 0x0804c000 LOCAL OBJ 0 _GLOBAL_OFFSET_TABLE_29 0x00003024 0x0804c024 GLOBAL OBJ 0 __dso_handle30 0x00002004 0x0804a004 GLOBAL OBJ 4 _IO_stdin_used35 0x00002000 0x0804a000 GLOBAL OBJ 4 _fp_hw41 ---------- 0x0804c028 GLOBAL OBJ 0 __TMC_END__7 ---------- ---------- GLOBAL OBJ 16 imp.stdout