Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS - crash after hook #38

Open
suale-dev opened this issue Jul 18, 2019 · 2 comments
Open

iOS - crash after hook #38

suale-dev opened this issue Jul 18, 2019 · 2 comments

Comments

@suale-dev
Copy link

suale-dev commented Jul 18, 2019

I built the lib for ios in debug mode. And build a demo iOS app with objective-c
Below is my function to test hook:

char *(*Origin_getenv)(const char *);
char *Hooked_getenv(const char *name) {
if (!strcmp(name, "lody")) {
return strdup("are you ok?");
}
char *(*O)(const char *) = Origin_getenv;
return O(name);
}

int testHook() {
void *handle = dlopen("libc.dylib", RTLD_NOW);
assert(handle != nullptr);
void *symbol = dlsym(handle, "getenv");
assert(symbol != nullptr);
WInlineHookFunction(
symbol,
reinterpret_cast<void *>(Hooked_getenv),
reinterpret_cast<void **>(&Origin_getenv)
);
const char *val = getenv("lody");
if (val != nullptr) {
std::cout << val;
}
return 0;
}

After call testHook function, hooked function work, but the app is crashed later.
Screen Shot 2019-07-18 at 10 14 01 PM

iOS 12 - iPhone 6 & iPhone 7.

@fettdrac
Copy link

Whale的WInlineHook调用原过程基本会崩溃,老bug了,可能是恢复现场那段shellcode写的有问题,不会汇编也咱也没法修,我都是下源码加个Cyida Hook库替换着凑合用的(Android)

@liumengdeqq
Copy link

等待大佬新内核突破写权限

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants