Jump to content

Disassembled code in IDA does not match that in GDB/LLDB


infernusdoleo

9 posts in this topic

Recommended Posts

As I said in my first post, pretty new to decompiling and the like, but a long time coder and I pick stuff up quickly. So please excuse any noobishness or ignorance.

 

I'm trying to reverse engineer an app on iOS. Its been one hell of a process getting this far. After hitting many walls, I picked up a refurb macbook air yesterday, as most of the walls I hit seemed to be able to be bypassed by using a mac for the rest of the work.

 

Made it farther than ever before last night - got a watchpoint to break on a known memory location! Yes! Next step, disassemble the code there, find out whats going on, and how to hack/patch it.

 

Brief setup:

App running on ipod 6th gen (only device I have that wasnt on iOS 9.1+ already, ie: jailbreakable) iOS 9.0.2. debugserver from Xcode 7 running on it. Debugserver attached to a cracked, thinned armv7 binary, which I had to first load into gdb to patch out the ptrace anti-debug crap (start gdb, break ptrace, set $r0=-1, continue, disconnect - side note, while I wait for help here I'm gonna try patching that out in the binary itself to skip this step in the future). Remote lldb session running from command line on macbook air.

 

So, I find the location of the code where it's modifying the memory. I then do a disassemble --frame, and it spits out code that looks weird.

 

vsub.f32 d18, d18, d22

movt r1, #0xf767

adcs r0, r1

 

A lot of that doesnt look familiar at all... I go to the same location in my disassembled copy of the same binary in IDA, and the code is totally different. First of all, I have zero lines that have more than 2 "arguments" to it, it's always an instruction then 2 arguments. So the vsub.f32 with the 3 arguments is odd. Second, nowhere in that area of code do I see a vsub.f32 or an adcs anywhere.

 

So I check the starting address for the function, and its 3BEB78 in the lldb output, but the function at the address in IDA starts at 3BEB44.

 

So I think I'm debugging the wrong binary, so I transfer it from the ipod again, and reload it. No change.

 

I think that because its a 32 bit binary on a 64 bit device, maybe I need to open it in IDA differently. I change the arm type a few times, the output changes, but none match. I try IDA64, nothing.

 

I then remember a bug I had in lldb where I tried to load the symbols from the binary I moved over locally (it complained some error, so I stopped doing it). I re-transferred the binary and tried again. Same error. So I do a target info, and I see something weird.

Target #0: /path/appname { arch=armv7s-apple-ios, platform=remote-ios, pid=40071, state=stopped }

Target #1: /home/me/appname { arch=armv7-apple-ios, platform=remote-ios }

 

The local copy of the binary is listed as armv7 - which is confirmed on the ipod itself via lipo -detailed_info:

 
iPod-touch:~ root# lipo -detailed_info /path/appname
Fat header in: /path/appname
fat_magic 0xcafebabe
nfat_arch 1
architecture armv7
    cputype CPU_TYPE_ARM
    cpusubtype CPU_SUBTYPE_ARM_V7
    offset 16384
    size 13224544
    align 2^14 (16384)
 
But the REMOTE running copy is reporting as armv7s
 
I think that may be changing how my app is being decompiled in lldb.
 
So I google and I see mention of rebasing the program in IDA, by finding the base address with a info proc map in gdb. Failure - my gdb doesn't have that. I have no /proc directory on the ipod. I try procexp and it gives me a base of 0d4000 (I think, the output is odd) and when I go to rebase it, IDA says the base is 0x4000, so its close, so, maybe? I rebase, but no, it's now tottally wrong.
 
I'm at a loss what to do next. Googling how to find the memory map in lldb isnt coming up with anything. I see no options to specify the arch when using debugserver (since I read thats what reports the arch to the client). Cant see how to set it manually in the client.
 
Anyone? I'm dying here. Thanks.
 

Did you get the correct address from IGG/GP?

Also the LLDB address isn't always the hackable function look around it

and you can breakpoint the function to see if it correct or not ^_^

Yes I got the address from iGG, and I confirmed that it's right. Dumping the memory at that location, after I change the data in-app dumps the new data.

 

But regardless, when I disassemble the code around the address in the frame that lldb tells me is what cause the memory to change, the same code in IDA looks different. Thats my problem. Either lldb is disassembling it wrong (because it thinks it's armv7s instead of armv7) or IDA is disassembling it wrong, having the wrong offsets.

 

Thats the issue, not that I cannot find the code.


Hmm it seems my issue may be due to ASLR. Googling...

Yes I got the address from iGG, and I confirmed that it's right. Dumping the memory at that location, after I change the data in-app dumps the new data.

 

But regardless, when I disassemble the code around the address in the frame that lldb tells me is what cause the memory to change, the same code in IDA looks different. Thats my problem. Either lldb is disassembling it wrong (because it thinks it's armv7s instead of armv7) or IDA is disassembling it wrong, having the wrong offsets.

 

Thats the issue, not that I cannot find the code.

Hmm it seems my issue may be due to ASLR. Googling...

if it the ASLR then you can remove it easily also is your binary cracked? 

because the cracking tools normally remove the ASLR

also thin your binary before using IGG to know the address if you didn't before

Thats the issue. The next one is when I disable ASLR the app won't run anymore. This is a damn nightmare! :)

sign the binary and make the permissions 777 ^_^

also the binary need to be cracked before use it in IDA also thin it ^_^

No matter which method I use to remove ASLR it crashes when I run it. I'm just connecting, checking the ASLR offset, then rebasing IDA with that value. Annoying when I need to restart the app, but it works.

Hey infernusdoleo , how you did a rebase in IDA Pro? I have the same problem on my Reversed App, wrong offset and wrong llldb address please if you have time write me back,

 

Thanks

 

ELREYS

No matter which method I use to remove ASLR it crashes when I run it. I'm just connecting, checking the ASLR offset, then rebasing IDA with that value. Annoying when I need to restart the app, but it works.

Hey bud,

 

Since Remove ASLR isn't working for you, maybe you should give this a go? The tool, linked below, can thin binaries, remove ASLR, class dump, strings, and symbols.

 

https://iosgods.com/topic/20338-binary-tools-online-strings-symbols-binary-thinning-class-dump-and-remove-aslrpie/

No matter which method I use to remove ASLR it crashes when I run it. I'm just connecting, checking the ASLR offset, then rebasing IDA with that value. Annoying when I need to restart the app, but it works.

  

Hey infernusdoleo , how you did a rebase in IDA Pro? I have the same problem on my Reversed App, wrong offset and wrong llldb address please if you have time write me back,

Thanks

ELREYS

^^

 

You can also defeat ASLR without removing it: https://iosgods.com/topic/19378-how-to-defeatremove-aslr-on-ios-9-armv7-and-arm64-devices/

Archived

This topic is now archived and is closed to further replies.

  • Our picks

    • [ Re:Dive KR ] 프린세스 커넥트! Re:Dive Cheats v10.1.8 +3
      Modded/Hacked App: 프린세스 커넥트! Re:Dive By Kakao Games Corp.
      Bundle ID: com.kakaogames.pcr
      iTunes Store Link: https://apps.apple.com/kr/app/%ED%94%84%EB%A6%B0%EC%84%B8%EC%8A%A4-%EC%BB%A4%EB%84%A5%ED%8A%B8-re-dive/id1452123050?uo=4


      Hack Features:
      - Multiply Attack
      - Multiply Defense
      - Instant Skill


      iOS Hack Download Link: https://iosgods.com/topic/148422-%ED%94%84%EB%A6%B0%EC%84%B8%EC%8A%A4-%EC%BB%A4%EB%84%A5%ED%8A%B8-redive-cheats-v403-3/
      • 97 replies
    • Dungero: Rumble Offline RPG v1.7.23 +3 Jailed Cheats [ Damage + More ]
      Modded/Hacked App: Dungero: Rumble Offline RPG By Retrobot s.r.o.
      Bundle ID: com.retrobot.dungero
      iTunes Store Link: https://apps.apple.com/us/app/dungero-rumble-offline-rpg/id1620904103?uo=4


      Hack Features:
      - Unlimited Currencies -> Earn or spend some.
      - Damage Multiplier *Untested*
      - All Zones Unlocked


      Jailbreak required hack(s): [Mod Menu Hack] Dungero: Rumble Offline RPG v1.7.23 +3 Cheats [ Damage + More ] - Free Jailbroken Cydia Cheats - iOSGods
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
      • 0 replies
    • Dungero: Rumble Offline RPG v1.7.23 +3 Cheats [ Damage + More ]
      Modded/Hacked App: Dungero: Rumble Offline RPG By Retrobot s.r.o.
      Bundle ID: com.retrobot.dungero
      iTunes Store Link: https://apps.apple.com/us/app/dungero-rumble-offline-rpg/id1620904103?uo=4


      Hack Features:
      - Unlimited Currencies -> Earn or spend some.
      - Damage Multiplier *Untested*
      - All Zones Unlocked


      Non-Jailbroken & No Jailbreak required hack(s): [IPA Mod Menu] Dungero: Rumble Offline RPG v1.7.23 +3 Jaileds Cheats [ Damage + More ] - Free Non-Jailbroken IPA Cheats - iOSGods
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
      • 0 replies
    • [ FFBE WoTV Japan ] FFBE幻影戦争 WAR OF THE VISIONS Cheats v11.2.0 +3
      Modded/Hacked App: FFBE幻影戦争 戦略RPG/シミュレーションゲーム By SQUARE ENIX Co., Ltd.
      Bundle ID: com.square-enix.WOTVffbejp
      iTunes Store Link: https://apps.apple.com/jp/app/ffbe%E5%B9%BB%E5%BD%B1%E6%88%A6%E4%BA%89-%E6%88%A6%E7%95%A5rpg-%E3%82%B7%E3%83%9F%E3%83%A5%E3%83%AC%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%82%B2%E3%83%BC%E3%83%A0/id1443703517?uo=4


      Hack Features:
      - Multiply Attack
      - Multiply Defense
      - Full Map Movement


      iOS Hack Download Link: https://iosgods.com/topic/173484-ffbe-wotv-japan-ffbe%E5%B9%BB%E5%BD%B1%E6%88%A6%E4%BA%89-war-of-the-visions-cheats-v916-3/
      • 51 replies
    • [ Seven Deadly Sins KR ] 일곱 개의 대죄: GRAND CROSS Cheats v8.6.56 +5
      Modded/Hacked App: 일곱 개의 대죄: GRAND CROSS By Netmarble Corporation
      Bundle ID: com.netmarble.nanakr
      iTunes Store Link: https://apps.apple.com/kr/app/%EC%9D%BC%EA%B3%B1-%EA%B0%9C%EC%9D%98-%EB%8C%80%EC%A3%84-grand-cross/id1449552940?uo=4


      Hack Features:
      - God Mode
      - One Hit Kill
      - Multiply Attack
      - Multiply Defense
      - Make Enemies God Mode for some quests


      iOS Hack Download Link: https://iosgods.com/topic/154899-seven-deadly-sins-kr-%EC%9D%BC%EA%B3%B1-%EA%B0%9C%EC%9D%98-%EB%8C%80%EC%A3%84-grand-cross-cheats-v750-5/
        • Like
      • 150 replies
    • [ Seven Deadly Sins JP ] - 七つの大罪 光と闇の交戦 : グラクロ Cheats v8.6.56 +5
      Modded/Hacked App: 七つの大罪 光と闇の交戦 : グラクロ By Netmarble Corporation
      Bundle ID: com.netmarble.nanatsunotaizai
      iTunes Store Link: https://apps.apple.com/jp/app/七つの大罪-光と闇の交戦-グラクロ/id1268959718?uo=4&at=1010lce4


      Hack Features:
      - God Mode
      - OHK


      iOS Hack Download Link: https://iosgods.com/topic/112888-seven-deadly-sins-%E4%B8%83%E3%81%A4%E3%81%AE%E5%A4%A7%E7%BD%AA-%E5%85%89%E3%81%A8%E9%97%87%E3%81%AE%E4%BA%A4%E6%88%A6-%E3%82%B0%E3%83%A9%E3%82%AF%E3%83%AD-v340-god-mode-unlimited-mp/
        • Informative
        • Like
      • 1,044 replies
    • Toram Online v4.0.55 - [ Custom Move Speed & More ]
      Modded/Hacked App: Toram Online By ASOBIMO,Inc.
      Bundle ID: com.asobimo.toramonline
      iTunes Store Link: https://itunes.apple.com/us/app/toram-online/id988683886?mt=8&uo=4&at=1010lce4
       

      Mod Requirements:
      - Jailbroken iPhone/iPad/iPod Touch.
      - iFile / Filza / iFunBox / iTools or any other file managers for iOS.
      - Cydia Substrate or Substitute.
      - PreferenceLoader (from Cydia or Sileo).


      Hack Features:
      - Custom Move Speed
      - God Mode 
      - Fast Attack Speed
      - Fast Cast Speed
      - Always Critical Chance
      - Never Miss Hit 
      - Mobs/Bosses Can't Avoid & Guard 
      - Quick Draw
      - Armor Break
      - Magic Wall - Stun + Full Map Hack 
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 2,535 replies
    • The Seven Deadly Sins Cheats v2.68.0 +5
      Modded/Hacked App: The Seven Deadly Sins by Netmarble Corporation
      Bundle ID: com.netmarble.nanagb
      iTunes Store Link: https://apps.apple.com/us/app/the-seven-deadly-sins/id1475440231?uo=4&at=1010lce4


      Hack Features:
      - God Mode
      - OHK
      - Infinite MP


      iOS Hack Download Link: https://iosgods.com/topic/131686-arm64-the-seven-deadly-sins-cheats-v117-3/
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 1,996 replies
    • Sausage Man v19.17 +8 Cheats
      Modded/Hacked App: Sausage Man By XD Entertainment Pte Ltd
      Bundle ID: com.xd.GlobalSoFunny.Sausage
      iTunes Store Link: https://apps.apple.com/us/app/sausage-man/id1563750315?uo=4


      Hack Features:
      - Walk On Water
      - Custom FOV
      - Custom Speed
      - No Recoil
      - No Shake
      - No Muzzle Flash
      - Superman
      - No Fire Sound
      - No Reload Sound
      - No Bow Sound
      Notes:
      - FOV set it to around 100.
      - Speed, set it around 10 and see if the server registers your speed.


      Non-Jailbroken & No Jailbreak required hack(s): https://iosgods.com/topic/164220-sausage-man-v1639-6-cheats-for-jailed-idevices/


      iOS Hack Download Link: https://iosgods.com/topic/147566-sausage-man-v1639-8-cheats/
        • Like
      • 672 replies
    • Warhammer 40,000: Tacticus v1.25.11 +4 Cheats
      Modded/Hacked App: Warhammer 40,000: Tacticus By Snowprint Studios AB
      Bundle ID: com.snowprintstudios.tacticus
      iTunes Store Link: https://apps.apple.com/us/app/warhammer-40-000-tacticus/id1599937506?uo=4

      Hack Features:
      - Always Win [ even if all your characters die, you win ]
      - Custom Ability Stats
      - Ability Always Available
      - Game Speed Multiplier

      Note: Use characters that do ability attack to multiple enemies like Varro Tigurius & Bellator


      Non-Jailbroken & No Jailbreak required hack(s): https://iosgods.com/topic/163492-warhammer-40000-tacticus-v1133-3-cheats-for-jailed-idevices/


      iOS Hack Download Link: https://iosgods.com/topic/163377-warhammer-40000-tacticus-v1133-4-cheats/
      • 273 replies
    • Pixel Heroes Idle Cheats v1.00.0063 +3
      Modded/Hacked App: Pixel Heroes Idle By Zero To One Games CO., LTD
      Bundle ID: com.ztogames.ppki
      iTunes Store Link: https://apps.apple.com/us/app/pixel-heroes-idle/id6476479696?uo=4


      Hack Features:
      - Damage Multiplier
      - Defense Multiplier
      - Freeze Resources


      Non-Jailbroken & No Jailbreak required hack(s): 


      iOS Hack Download Link: https://iosgods.com/topic/184508-pixel-heroes-idle-v1000043-5-cheats/
      • 153 replies
    • [ The Sims Mobile ] TSM Game Cheats v48.0.2 +2
      Modded/Hacked App: The Sims™ Mobile by EA Swiss Sarl
      Bundle ID: com.ea.ios.simsmobile
      iTunes Store Link: https://apps.apple.com/us/app/the-sims-mobile/id1144258115?uo=4&at=1010lce4


      Hack Features:
      - Multiply Coin and Cash Earned
      - Infinite Energy


      Non-Jailbroken & No Jailbreak required hack(s): https://iosgods.com/topic/66166-arm64-the-sims-mobile-v2200-jailed-cheats-2/


      Hack Download Link: https://iosgods.com/topic/66035-arm64-the-sims-mobile-cheats-all-versions-2/
        • Haha
        • Thanks
        • Winner
        • Like
      • 3,946 replies
×
  • Create New...

Important Information

We would like to place cookies on your device to help make this website better. The website cannot give you the best user experience without cookies. You can accept or decline our cookies. You may also adjust your cookie settings. Privacy Policy - Guidelines