Hot answers tagged

36

Compiler The choice of a compiler has minimal effects on the difficulty to reverse engineer your code. The important things to minimize are all related to information leaks from your code. You want to at least disable any runtime type information (RTTI). The leakage of type information and the simplicity of the instruction set of the virtual machine is one ...


15

Let me start by telling you that what you want would be impossible, because of how well-known DLLs work. You can attempt something similar with tools like PEBundle or dllpackager, but that will usually (I'd say certainly) fail with the well-known DLLs (such as system DLLs as well as even the MSVC runtime DLLs in their different incarnations). See this and ...


15

The Windows kernel, unlike Linux or OS X, does not use consistent syscall numbering across versions. The numbers can change even after a servicepack release. For example, the NtReadFile syscall was 0x0086 on Windows NT 4 but on Windows 7 it's 0x0111 (see here for the full list). That's why all proper programs use the kernel32.dll (or ntdll.dll) to perform ...


9

You can simply export the environment variable LD_PRELOAD (on Linux) or DYLD_INSERT_LIBRARIES (on OS X) pointing to (the full path of) your library before running your target, like in this example: https://stackoverflow.com/questions/6083337/overriding-malloc-using-the-ld-preload-mechanism This is for hooking functions to do whatever you want (not to spy ...


9

There're two broad ways in which you can declare JNI functions. The first is the more obvious way in which the JNI function has to follow a specific naming convention like JNIEXPORT void JNICALL Java_com_app_foo_bar. You can easily identify such functions using readelf. The other not so obvious way is to use RegisterNatives. Here your functions can have ...


8

ldd The program ldd is wrong for a few reasons. First, ldd is not meant to be accurate for determining load addresses. Use the environment variable LD_TRACE_LOADED_OBJECTS. Second, ldd will never be correct with ASLR enabled as Guntram showed. You can disable this pretty trivially if you have sudo access. $ LD_TRACE_LOADED_OBJECTS=1 /bin/bash | grep ...


8

TL;DR you can call anything, locating the right part of code is the hard part. export table If you mean 'just as Windows does', then you mean the functions of the DLL that are available to the others, ie the exported ones? in this case, you need to parse the export table - check pefile for a readable and reliable implementation. locating any function IDA If ...


8

Check the trace family: ltrace: a library tracer strace: a kernel call (syscall) tracer ptrace: a programmable tracer and also: radare's itrace


7

This page contains an IDC script And a Windbg Extension to dump the names and a WinDbg extension to load those names into WinDbg. Edit To Address the comment by @OzgurH yes the idc as well as AddSyntheticSymbol are slow in fact getting a list of Names along with the boundaries from idc is tedious (also it was done in idafree 5 which isn't available for ...


7

Make sure if you have the correct breakpoint address issue lm an exe without symbol will be shown as 0:000> lm start end module name 00400000 0040f000 image00400000 (no symbols) compare the NtHeader->AddresssOfEntrypoint with @$exentry 0:000> r $t0 = image00400000 0:000> ?? ((ntdll!_IMAGE_NT_HEADERS *) @@( poi( @$t0 + 0x3c ...


6

For OS X, dtrace should do the trick. dtrace is supposed to exist for Linux as well, though I don’t know how well it is supported, and I believe there are other equivalent tools there.


5

dynamic_cast requires a runtime check that the cast is valid at execution time and the usual implementation uses RTTI (Run-time type information) attached to all classes participating in the casts. However, since it's not easy to narrow down the classes that may be possibly casted, in practice the compiler emits RTTI for all polymorphic classes (i.e. those ...


5

It's possible since Hopper v3, under File > Read Debug Symbols File...


5

afaik, Symbol Visibility is not available in radare2. The closest to this you can get are the symbol bindings and types. You can do this with the is command which is responsible for showing symbols. $ r2 /bin/echo -- What do you want to debug today? [0x00401800]> is [Symbols] 050 0x00007228 0x00607228 GLOBAL OBJ 8 stdout 051 0x00007220 0x00607220 ...


4

It is possible that you are using RTTI. Try compiling your code with option -fno-rtti. Update: It is really RTTI. I don't know how exactly it works, but I succeeded to remove those strings as follows: $ g++ -Xlinker -unexported_symbol -Xlinker "*" -o executable file.cpp $ strip executable (This was found at https://stackoverflow.com/questions/1931626/...


4

I worked with some types of symbol tables. All these types are very different and can not be defined as something that allows automatic detection. It can be some kind of list of tuples like (pointer to name, type, pointer to object, [something else]). There are a lot of other variants also. Any time I succeeded to recognize symbol table it was done by ...


4

I wrote a Python script that parses entry points and imports from a Mach-O executable for one of my projects. The trick is to parse the LC_DYLD or LC_DYLD_ONLY loader commands. These two commands encode three import tables: bound symbols, weak symbols, and lazy symbols. struct dyld_info_command { uint32_t cmd; uint32_t cmdsize; uint32_t rebase_off; ...


4

the numeric argument is is an offset into the "compressed dyld info" stream of bytecodes. see https://stackoverflow.com/a/8836580 (iOS/arm but still applies)


4

You can't seek to any symbol that shown by is, you can only seek to "flags" or addresses. The f command is used to list all the flags from the selected flagspace. By default all the available flagspaces are selected. For example, in order to select the 'symbols' flagspace and list only the flags inside it, use: [0x004049a0]> fs symbols [0x004049a0]> ...


3

First, ASLR will load the library at a (slightly) different address with each invocation, to help protect against malware. This is why the addresses between ldd and gdb are different, and why they may be even different each time you run gdb. If i just grep for the libc executable segment on my system (64 bit, as i didn't have a 32 bit system handy): $ grep ...


3

I've seen 4 naming conventions being used: vNNN() when decompiling ARM binaries (i.e.: Android JNI code) - not sure how it numbers them as it doesn't seem it's related to their position or address within the binary. sub_HHHHHH() when decompiling x86/64 binaries (i.e.: for Windows, OSX) with the actual address on the name _name/__name() for functions IDA is ...


3

A common issue is missing symsrv.dll. Please make sure you have it on the remote machine and that win32_remote.exe can find it. You can also append -z10000 to the command line in order to get more output from the MS-DIA libraries. Thanks to HexRays for this answer.


3

It sounds like you aren't sure what you want to do exactly. Is there any part of the firmware you want to reverse engineer in particular? I suggest you first start by reading some blog posts on devttys0.com, as he seems like an excellent source for information about reverse-engineering router firmwares. If a binary contains symbols, IDA Pro should ...


3

Those functions are exported from ntdll.dll file. To link with those functions, add #pragma comment (lib, "ntdll.lib") in the source file. Or in Visual Studio, first check the active Configuration and Platform. Then add the library in Project > Properties > Linker > Input > Additional Dependencies. For example, like this %(AdditionalDependencies); ntdll.lib. ...


3

There can be multiple reasons. the FLIRT signatures which have been loaded automatically do not have a pattern for this specific function. You can check which signatures have been applied and try loading additional ones via Signatures view (Shift-F5). the function pattern was conflicting with another function(s) and has been dropped from the final signature ...


2

Probably with full intent from MS, not only does syscall numbering change between versions, but also many DLL ordinal values do too. Need to bind to WIN32 and use the full function name if you want your code to work across os releases.


2

As pointed out in the first comment: firmware may have a custom format, therefore there is no general way to extract the symbols table from it. However, you can extract the debugging symbols from an ELF binary using objcopy. The command should look something like: objcopy --only-keep-debug binary_file output_file_with_debug_symbols If you inspect the ...


2

Try compiling your program as a static assembly, and strip it using the compiler. You won't find any 'cling' references in the resultant executable. $ g++ -static -s cling.cpp -o cling $ ls -l cling* -rwxr-x--- 1 lornix lornix 1,313,792 Jun 22 19:19 cling* -rw-r----- 1 lornix lornix 222 Jun 22 19:16 cling.cpp $ strings -a cling | grep -ic cling 0


2

You would need to ask the developers of those Android / iOS apps for the symbols. It's very unlikely that they've made their apps' symbols publicly available. However, keep in mind that although symbols are helpful, they aren't required to reverse engineer an app.


Only top voted, non community-wiki answers of a minimum length are eligible