Jump to content

Dealing with ASLR in Palera1n Jailbreak


5 posts in this topic

Recommended Posts

I have been getting the virtual memory address slide amount of the application by

#include <mach-o/dyld.h>
_dyld_get_image_vmaddr_slide(0);

_dyld_get_image_vmaddr_slide: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/dyld.3.html

However, on Palera1n (v1.4.1), "/usr/lib/substitute-loader.dylib" seems to be the 0th image index.
Therefore, the argument to _dyld_get_image_vmaddr_slide must be 1.

uint64_t getRealOffset(uint64_t offset) {
    return _dyld_get_image_vmaddr_slide(1) + offset;
    // return _dyld_get_image_vmaddr_slide(0) + offset;
}

 

With Framework

If the image index is not fixed as in Unity, it can be done as follows

#include <string.h>
#include <stdlib.h>

uint64_t getRealOffset$Palera1n(const char *image_name, uint64_t offset) {
    if (image_name == NULL) {
        const char *progname = getprogname();
        if (progname) {
            return getRealOffset$Palera1n(progname, offset);
        }
        return _dyld_get_image_vmaddr_slide(1) + offset;
    }

    const uint32_t image_count = _dyld_image_count();
    for (int i = 0; i < image_count; ++i) {
        if (strstr(_dyld_get_image_name(i), image_name)) {
            return _dyld_get_image_vmaddr_slide(i) + offset;
        }
    }
    // error...
    return offset;
}

getprogname: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/getprogname.3.html

Example argument for image_name:

// PUBG
getRealOffset$Palera1n("ShadowTrackerExtra", 0x100345678);
// or
getRealOffset$Palera1n(NULL, 0x100345678);

// YouTube
getRealOffset$Palera1n("YouTube", 0x100345678);
// or
getRealOffset$Palera1n(NULL, 0x100345678);

// Unity - (e.g. Survivor!.io)
getRealOffset$Palera1n("UnityFramework", 0x345678);

 

Conclusion

The following may only work with Palera1n or only with the current version of Palera1n.

const uint64_t slide = _dyld_get_image_vmaddr_slide(1);
MSHookFunction((void *)(0x100345678 + slide), ...);
MSHookFunction((void *)(0x100789ABC + slide), ...);

It might be better to specify by image name so that it works without worrying about the argument to _dyld_get_image_vmaddr_slide.

const uint64_t slide = getRealOffset$Palera1n("ImageName", 0x0);
if (slide) {
    MSHookFunction((void *)(0x100345678 + slide), ...);
    MSHookFunction((void *)(0x100789ABC + slide), ...);
}

 

Updated by tat5
Conclusion was not good.
Link to comment
https://iosgods.com/topic/167049-dealing-with-aslr-in-palera1n-jailbreak/
Share on other sites

Could you try this?
 

uint64_t getRealOffset(uint64_t offset) {

    if (strstr(_dyld_get_image_name(0), "substitute")) { 
        return _dyld_get_image_vmaddr_slide(1) + offset;
    }

    const uint32_t image_count = _dyld_image_count();
    for (int i = 0; i < image_count; ++i) {
        if (strstr(_dyld_get_image_name(i), "UnityFramework")) { 
            return _dyld_get_image_vmaddr_slide(i) + offset;
        }
    }

    return _dyld_get_image_vmaddr_slide(0) + offset; // if not our base executable is the traditional?
}



 

Updated by quatorze
46 minutes ago, quatorze said:

Could you try this?
 

uint64_t getRealOffset(uint64_t offset) {
 
    const uint32_t image_count = _dyld_image_count();
     for (int i = 0; i < image_count; ++i) {
        if (strstr(_dyld_get_image_name(0), "substitute")) { // check if substitute loaded as 1st image
            return _dyld_get_image_vmaddr_slide(1) + offset;
        } else if (strstr(_dyld_get_image_name(i), "UnityFramework")) { // check for unityframework
                return _dyld_get_image_vmaddr_slide(i) + offset;
            } else {
                   return _dyld_get_image_vmaddr_slide(0) + offset; // if not our base executable is the traditional?  
            }

       NSLog(@"An error occured");
       return offset;
}

Wouldn't it terminate the for loop once?
I don't think it works well when UnityFramework is the target.

Is this what you mean?

uint64_t getRealOffset(uint64_t offset) {
    if (strstr(_dyld_get_image_name(0), "substitute")) { // check if substitute loaded as 1st image
        return _dyld_get_image_vmaddr_slide(1) + offset;
    }

    const uint32_t image_count = _dyld_image_count();
    for (int i = 0; i < image_count; ++i) {
        if (strstr(_dyld_get_image_name(i), "UnityFramework")) { // check for unityframework
            return _dyld_get_image_vmaddr_slide(i) + offset;
        }
    }

    return _dyld_get_image_vmaddr_slide(0) + offset; // if not our base executable is the traditional?
}

It may not be able to deal with the case where the next of substitute is not the correct answer. I don't know if such a case can happen...

if (strstr(_dyld_get_image_name(0), "substitute")) { // check if substitute loaded as 1st image
    return _dyld_get_image_vmaddr_slide(1) + offset;// Absolutely?
}

I just think your code is cleaner and better.🙆‍♂️

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below. For more information, please read our Posting Guidelines.
Reply to this topic... Posting Guidelines

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Our picks

    • Screw Jam v3.4.2 +20++ Jailed Cheats [ Debug Menu ]
      Modded/Hacked App: Screw Jam By Rollic Games Oyun Yazilim ve Pazarlama Anonim Sirketi
      Bundle ID: com.quok.screwJam
      iTunes Store Link: https://apps.apple.com/us/app/screw-jam/id6471490579?uo=4


      Hack Features:
      - Debug Menu -> Head into Settings and toggle the Contact Us button. To close out the menu, restart the game.


      Jailbreak required hack(s): [Mod Menu Hack] Screw Jam v2.1.0 +20++ Cheats [ Debug Menu ] - 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/
        • Like
      • 16 replies
    • Screw Jam v3.4.2 +20++ Cheats [ Debug Menu ]
      Modded/Hacked App: Screw Jam By Rollic Games Oyun Yazilim ve Pazarlama Anonim Sirketi
      Bundle ID: com.quok.screwJam
      iTunes Store Link: https://apps.apple.com/us/app/screw-jam/id6471490579?uo=4


      Hack Features:
      - Debug Menu -> Head into Settings and toggle the Contact Us button. To close out the menu, restart the game.


      Non-Jailbroken & No Jailbreak required hack(s): [Non-Jailbroken Hack] Screw Jam v2.1.0 +20++ Jailed Cheats [ Debug Menu ] - 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/
        • Agree
        • Haha
        • Like
      • 15 replies
    • K-Pop Academy v1.1.3 +5 Jailed Cheats [ Unlimited Currencies ]
      Modded/Hacked App: K-Pop Academy By HyperBeard Inc.
      Bundle ID: com.hyperbeard.idolpopstars
      iTunes Store Link: https://apps.apple.com/us/app/k-pop-academy/id1627015599?uo=4


      Hack Features:
      - Unlimited Coins
      - Unlimited Gems
      - Unlimited Tickets
      - Unlimited Fame
      - Unlimited Experience


      Jailbreak required hack(s): [Mod Menu Hack] K-Pop Academy v1.0.1 +5 Cheats [ Unlimited Currencies ] - 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/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 7 replies
    • K-Pop Academy v1.1.3 +5 Cheats [ Unlimited Currencies ]
      Modded/Hacked App: K-Pop Academy By HyperBeard Inc.
      Bundle ID: com.hyperbeard.idolpopstars
      iTunes Store Link: https://apps.apple.com/us/app/k-pop-academy/id1627015599?uo=4


      Hack Features:
      - Unlimited Coins
      - Unlimited Gems
      - Unlimited Tickets
      - Unlimited Fame
      - Unlimited Experience


      Non-Jailbroken & No Jailbreak required hack(s): [IPA Mod Menu] K-Pop Academy v1.0.1 +5 Jailed Cheats [ Unlimited Currencies ] - 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/
        • Agree
        • Thanks
        • Like
      • 11 replies
    • Sunday City: Sim Life v1.3 +1 Jailed Cheat [ Speed Hack ]
      Modded/Hacked App: Sunday City: Sim Life By AP KEFIR LTD
      Bundle ID: adventure.party.real.life
      iTunes Store Link: https://apps.apple.com/ca/app/sunday-city-sim-life/id6450834358?uo=4


      Hack Features:
      - Move Speed Multiplier


      Jailbreak required hack(s): [Mod Menu Hack] Sunday City: Sim Life v1.1 +1 Cheat [ Speed Hack ] - 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/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 20 replies
    • Subway Surfers City v1.18.1 +10 Jailed Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Subway Surfers City By Sybo Games ApS
      Bundle ID: com.sybogames.subway.surfers.game
      iTunes Store Link: https://apps.apple.com/ca/app/subway-surfers-city/id6504188939?uo=4


      Mod Requirements:
      - Non-Jailbroken/Jailed or Jailbroken iPhone/iPad/iPod Touch.
      - Sideloadly / Cydia Impactor or alternatives.
      - A Computer Running Windows/macOS/Linux with iTunes installed.


      Hack Features:
      - Unlimited Coins -> Earn or spend some.
      - Unlimited Keys -> Earn or spend some.
      - Unlimited Revives - Earn or spend some.
      - Unlimited Tokens -> Earn or spend some.
      - All Boards Unlocked
      - All Surfers Unlocked
      - Max Level -> Earn some XP.
      - God Mode
      - Unlimited Score
      - Unlimited Jumps


      Jailbreak required hack(s): [Mod Menu Hack] Subway Surfers City v1.13.2 +7 Cheats [ Unlimited Currencies ] - 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/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 141 replies
    • Subway Surfers City v1.18.1 +10 Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Subway Surfers City By Sybo Games ApS
      Bundle ID: com.sybogames.subway.surfers.game
      iTunes Store Link: https://apps.apple.com/ca/app/subway-surfers-city/id6504188939?uo=4


      Hack Features:
      - Unlimited Coins
      - Unlimited Keys
      - Unlimited Revives
      - All Boards Unlocked
      - All Surfers Unlocked
      - Max Level -> Earn some XP.
      - God Mode


      Non-Jailbroken & No Jailbreak required hack(s): [Non-Jailbroken Hack] Subway Surfers City v1.13.2 +5 Jailed Cheats [ Unlimited Currencies ] - 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/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 33 replies
    • Backpack Brawl v0.26.0 +1++ Jailed Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Backpack Brawl By 1986 GAMES SIA
      Bundle ID: com.rapidfiregames.backpackbrawl
      iTunes Store Link: https://apps.apple.com/us/app/backpack-brawl/id6479175676?uo=4


      Hack Features:
      - Unlimited Currencies -> Earn some.


      Jailbreak required hack(s): [Mod Menu Hack] Backpack Brawl v0.14.0 +1++ Cheats [ Unlimited Currencies ] - 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/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 43 replies
    • Backpack Brawl v0.26.0 +1++ Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Backpack Brawl By 1986 GAMES SIA
      Bundle ID: com.rapidfiregames.backpackbrawl
      iTunes Store Link: https://apps.apple.com/us/app/backpack-brawl/id6479175676?uo=4


      Hack Features:
      - Unlimited Currencies -> Earn some.


      Non-Jailbroken & No Jailbreak required hack(s): [Non-Jailbroken Hack] Backpack Brawl v0.14.0 +1++ Jailed Cheats [ Unlimited Currencies ] - 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/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 36 replies
    • Sunday City: Sim Life v1.3 +1 Cheat [ Speed Hack ]
      Modded/Hacked App: Sunday City: Sim Life By AP KEFIR LTD
      Bundle ID: adventure.party.real.life
      iTunes Store Link: https://apps.apple.com/ca/app/sunday-city-sim-life/id6450834358?uo=4


      Hack Features:
      - Move Speed Multiplier


      Non-Jailbroken & No Jailbreak required hack(s): https://iosgods.com/forum/79-no-jailbreak-section/
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
        • Agree
        • Like
      • 13 replies
    • Idle Zombie Miner: Gold Tycoon v2.142.1287 +1++ Jailed Cheat [ Unlimited Currencies ]
      Modded/Hacked App: Idle Zombie Miner: Gold Tycoon By VISTREX LIMITED
      Bundle ID: com.zombie.idleminertycoon
      iTunes Store Link: https://apps.apple.com/us/app/idle-zombie-miner-gold-tycoon/id6471983323?uo=4


      Hack Features:
      - Unlimited Currencies -> Will increase instead of decrease.


      Jailbreak required hack(s): [Mod Menu Hack] Idle Zombie Miner: Gold Tycoon v2.53.1001 +1++ Cheat [ Unlimited Currencies ] - 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/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 43 replies
    • Idle Zombie Miner: Gold Tycoon v2.142.1287 +1++ Cheat [ Unlimited Currencies ]
      Modded/Hacked App: Idle Zombie Miner: Gold Tycoon By VISTREX LIMITED
      Bundle ID: com.zombie.idleminertycoon
      iTunes Store Link: https://apps.apple.com/us/app/idle-zombie-miner-gold-tycoon/id6471983323?uo=4


      Hack Features:
      - Unlimited Currencies -> Will increase instead of decrease.


      Non-Jailbroken & No Jailbreak required hack(s): [Non-Jailbroken Hack] Idle Zombie Miner: Gold Tycoon v2.53.1001 +1++ Jailed Cheat [ Unlimited Currencies ] - 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/
        • Informative
        • Agree
        • Thanks
        • Winner
        • Like
      • 32 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