You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/generic-methodologies-and-resources/basic-forensic-methodology/malware-analysis.md
+92-1Lines changed: 92 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -169,7 +169,98 @@ If the files of a folder **shouldn't have been modified**, you can calculate the
169
169
170
170
When the information is saved in logs you can **check statistics like how many times each file of a web server was accessed as a web shell might be one of the most**.
Modern malware families heavily abuse Control-Flow Graph (CFG) obfuscation: instead of a direct jump/call they compute the destination at run-time and execute a `jmp rax` or `call rax`. A small *dispatcher* (typically nine instructions) sets the final target depending on the CPU `ZF`/`CF` flags, completely breaking static CFG recovery.
177
+
178
+
The technique – showcased by the SLOW#TEMPEST loader – can be defeated with a three-step workflow that only relies on IDAPython and the Unicorn CPU emulator.
179
+
180
+
### 1. Locate every indirect jump / call
181
+
182
+
```python
183
+
import idautils, idc
184
+
185
+
for ea in idautils.FunctionItems(idc.here()):
186
+
mnem = idc.print_insn_mnem(ea)
187
+
if mnem in ("jmp", "call") and idc.print_operand(ea, 0) =="rax":
188
+
print(f"[+] Dispatcher found @ {ea:X}")
189
+
```
190
+
191
+
### 2. Extract the dispatcher byte-code
192
+
193
+
```python
194
+
import idc
195
+
196
+
defget_dispatcher_start(jmp_ea, count=9):
197
+
s = jmp_ea
198
+
for _ inrange(count):
199
+
s = idc.prev_head(s, 0)
200
+
return s
201
+
202
+
start = get_dispatcher_start(jmp_ea)
203
+
size = jmp_ea + idc.get_item_size(jmp_ea) - start
204
+
code = idc.get_bytes(start, size)
205
+
open(f"{start:X}.bin", "wb").write(code)
206
+
```
207
+
208
+
### 3. Emulate it twice with Unicorn
209
+
210
+
```python
211
+
from unicorn import*
212
+
from unicorn.x86_const import*
213
+
import struct
214
+
215
+
defrun(code, zf=0, cf=0):
216
+
BASE=0x1000
217
+
mu = Uc(UC_ARCH_X86, UC_MODE_64)
218
+
mu.mem_map(BASE, 0x1000)
219
+
mu.mem_write(BASE, code)
220
+
mu.reg_write(UC_X86_REG_RFLAGS, (zf <<6) | cf)
221
+
mu.reg_write(UC_X86_REG_RAX, 0)
222
+
mu.emu_start(BASE, BASE+len(code))
223
+
return mu.reg_read(UC_X86_REG_RAX)
224
+
```
225
+
226
+
Run `run(code,0,0)` and `run(code,1,1)` to obtain the *false* and *true* branch targets.
227
+
228
+
### 4. Patch back a direct jump / call
229
+
230
+
```python
231
+
import struct, ida_bytes
232
+
233
+
defpatch_direct(ea, target, is_call=False):
234
+
op =0xE8if is_call else0xE9# CALL rel32 or JMP rel32
Once the real destination of every `call rax` is known you can tell IDA what it is so parameter types & variable names are recovered automatically:
249
+
250
+
```python
251
+
idc.set_callee_name(call_ea, resolved_addr, 0) # IDA 8.3+
252
+
```
253
+
254
+
### Practical benefits
255
+
256
+
* Restores the real CFG → decompilation goes from *10* lines to thousands.
257
+
* Enables string-cross-reference & xrefs, making behaviour reconstruction trivial.
258
+
* Scripts are reusable: drop them into any loader protected by the same trick.
259
+
260
+
---
173
261
262
+
## References
174
263
264
+
-[Unit42 – Evolving Tactics of SLOW#TEMPEST: A Deep Dive Into Advanced Malware Techniques](https://unit42.paloaltonetworks.com/slow-tempest-malware-obfuscation/)
Copy file name to clipboardExpand all lines: src/mobile-pentesting/android-app-pentesting/reversing-native-libraries.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -61,15 +61,15 @@ Java.perform(function () {
61
61
});
62
62
});
63
63
```
64
-
Frida will work out of the box on PAC/BTI-enabled devices (Pixel 8/Android 14+) as long as you use frida-server 16.2 or later – earlier versions failed to locate padding for inline hooks. citeturn5search2turn5search0
64
+
Frida will work out of the box on PAC/BTI-enabled devices (Pixel 8/Android 14+) as long as you use frida-server 16.2 or later – earlier versions failed to locate padding for inline hooks.
65
65
66
66
---
67
67
68
68
### Recent vulnerabilities worth hunting for in APKs
69
69
70
70
| Year | CVE | Affected library | Notes |
71
71
|------|-----|------------------|-------|
72
-
|2023|CVE-2023-4863|`libwebp` ≤ 1.3.1|Heap buffer overflow reachable from native code that decodes WebP images. Several Android apps bundle vulnerable versions. When you see a `libwebp.so` inside an APK, check its version and attempt exploitation or patching.|citeturn2search0|
72
+
|2023|CVE-2023-4863|`libwebp` ≤ 1.3.1|Heap buffer overflow reachable from native code that decodes WebP images. Several Android apps bundle vulnerable versions. When you see a `libwebp.so` inside an APK, check its version and attempt exploitation or patching.||
73
73
|2024|Multiple|OpenSSL 3.x series|Several memory-safety and padding-oracle issues. Many Flutter & ReactNative bundles ship their own `libcrypto.so`.|
74
74
75
75
When you spot *third-party*`.so` files inside an APK, always cross-check their hash against upstream advisories. SCA (Software Composition Analysis) is uncommon on mobile, so outdated vulnerable builds are rampant.
@@ -92,7 +92,7 @@ When you spot *third-party* `.so` files inside an APK, always cross-check their
### Automated dynamic analysis with MobSF (no jailbreak)
108
108
109
-
[MobSF](https://mobsf.github.io/Mobile-Security-Framework-MobSF/) can instrument a dev-signed IPA on a real device using the same technique (`get_task_allow`) and provides a web UI with filesystem browser, traffic capture and Frida console【turn6view0†L2-L3】. The quickest way is to run MobSF in Docker and then plug your iPhone via USB:
109
+
[MobSF](https://mobsf.github.io/Mobile-Security-Framework-MobSF/) can instrument a dev-signed IPA on a real device using the same technique (`get_task_allow`) and provides a web UI with filesystem browser, traffic capture and Frida console【†L2-L3】. The quickest way is to run MobSF in Docker and then plug your iPhone via USB:
Copy file name to clipboardExpand all lines: src/pentesting-web/sql-injection/ms-access-sql-injection.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -141,7 +141,7 @@ Point the UNC path to:
141
141
* a host that drops the TCP handshake after `SYN-ACK`
142
142
* a firewall sinkhole
143
143
144
-
The extra seconds introduced by the remote lookup can be used as an **out-of-band timing oracle** for boolean conditions (e.g. pick a slow path only when the injected predicate is true). Microsoft documents the remote database behaviour and the associated registry kill-switch in KB5002984. citeturn1search0
144
+
The extra seconds introduced by the remote lookup can be used as an **out-of-band timing oracle** for boolean conditions (e.g. pick a slow path only when the injected predicate is true). Microsoft documents the remote database behaviour and the associated registry kill-switch in KB5002984.
145
145
146
146
### Other Interesting functions
147
147
@@ -229,7 +229,7 @@ Mitigations (recommended even for legacy Classic ASP apps):
229
229
* Block outbound SMB/WebDAV at the network boundary.
230
230
* Sanitize / parameterise any part of a query that may end up inside an `IN` clause.
231
231
232
-
The forced-authentication vector was revisited by Check Point Research in 2023, proving it is still exploitable on fully patched Windows Server when the registry key is absent. citeturn0search0
232
+
The forced-authentication vector was revisited by Check Point Research in 2023, proving it is still exploitable on fully patched Windows Server when the registry key is absent.
0 commit comments