Skip to content

Commit

Permalink
fix: missing add fixup in static library relocation
Browse files Browse the repository at this point in the history
  • Loading branch information
Soulghost committed May 10, 2021
1 parent 8ee2206 commit fd0f5b9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion iblessing/iblessing/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ int main(int argc, const char *argv[]) {
\n");

// hello text
printf("[***] iblessing iOS Security Exploiting Toolkit Beta 0.6.4 (http://blog.asm.im)\n");
printf("[***] iblessing iOS Security Exploiting Toolkit Beta 0.6.5 (http://blog.asm.im)\n");
printf("[***] Author: Soulghost (高级页面仔) @ (https://github.com/Soulghost)\n");

#ifdef IB_CSR_ENABLED
Expand Down
2 changes: 1 addition & 1 deletion iblessing/iblessing/scanner/ObjcMethodXrefScanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
//#define SkipPreScannerDriver
//#define Stalker
//#define UsingSet
//#define DebugMethod "mlist"
//#define DebugMethod "retrievePersistedAnonymousID"
//#define DebugTrackCall
//#define DebugClass "AFCXbsManager"
//#define ThreadCount 8
Expand Down
10 changes: 10 additions & 0 deletions iblessing/iblessing/scanner/context/ScannerContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,16 @@ scanner_err ScannerContext::setupWithBinaryPath(string binaryPath, bool reentry)
if (ks_asm(ks, fixup.c_str(), targetAddr, &encode, &size, &count) == KS_ERR_OK) {
needFix = true;
};
} else if (strcmp(insn->mnemonic, "add") == 0) {
string text = StringUtils::format("%s %s", insn->mnemonic, insn->op_str);
uint64_t relocPage = symtab->relocQuery(targetAddr);
uint64_t pageoff = relocPage & 0xfff;
vector<string> parts = StringUtils::split(text, ',');
string fixup = parts[0] + ", " + parts[1];
fixup += StringUtils::format(", #0x%llx", pageoff);
if (ks_asm(ks, fixup.c_str(), targetAddr, &encode, &size, &count) == KS_ERR_OK) {
needFix = true;
};
}

if (needFix) {
Expand Down

0 comments on commit fd0f5b9

Please sign in to comment.