پاکسازی ردپاهای رفتاری Behavioral Artifacts
پاکسازی رفتاری یعنی چی
همیشه فقط فایل و لاگ نیست که شما رو لو میده خیلی وقتا رفتار برنامه یه اثر جانبی تو سیستم میذاره مثل اینکه برنامه رفته یه مسیر خاص یه DLL لود کرده یه NamedPipe ساخته یا حتی یه کلید رجیستری کوتاه اضافه کرده
اینها اسمش میشه Behavioral Artifact
و بدترین چیز اینه که خیلیاش اصلا به چشم نمیاد ولی تو فارنزیک کاملا مشخصه و لو میرید
مهمترین رد پاهای رفتاری که معمولا میوفتن
Load شدن
های غیر معمولی DLL
وقتی ابزارتون یه DLL کاستوم لود میکنه
تو ETW Sysmon و حتی حافظه اثرش میمونه
Named Pipes
اگه ابزار IPC داره و pipe ساخته بشه
تو حافظه handle table و بعضی لاگها دیده میشه
Registry Keys موقتی
بعضی ابزارا برای config یا persistence آزمایشی کلید short-lived میسازن که همون باعث لو رفتنتون میشه
Network Artifacts
حتی اگر لاگ فایل وجود نداشته باشه
route
های باز شده DNS cache ARP cache و socket states ممکنه دیده بشه
Process Tree / Parent Spoofing
خیلی وقتا افراد فکر میکنن چون PPID Spoof کردن پس کار تمومه ولی artifact های مثل Token Thread start time و Memory layout
دستتون رو رو میکنه و لو میرید و همه چی افشا میشه
چطور باید پاکشون کنید
اگه ابزارای شما DLL لود میکنه pipe میسازه یا رجیستری دستکاری میکنه باید اونا رو طوری طراحی کنید که بعد از اجرا خودش cleanup کنه
Pipeline Cleanup
بعد از کارا:
pipe
ها رو ببندید
handle
ها رو free کنید
thread
ها رو join کنید
registry موقت رو حذف کنید
%50 افراد همین کارای ساده رو نمیکنن
کمکردن Interaction با سیستم عامل
هرچی syscalls کمتر
ردپا کمتر
محدود کردن Network Indicators
DNS cache، socket states و route
های باز شده
بعد از اتمام کار باید reset بشن
Memory Hygiene
Buffer
ها و ساختار هایی که حاوی metadata رفتاری هستن
نباید تو RAM بدون استفاده بشن
Cleaning up behavioral artifacts
What is behavioral cleaning?
It's not always just files and logs that give you away. Often, the program's behavior leaves a side effect on the system, such as the program going to a specific path, loading a DLL, creating a NamedPipe, or even adding a short registry key.
These are called Behavioral Artifacts.
And the worst thing is that many of them are not visible at all, but in forensics they are quite obvious and you get caught.
The most important behavioral traces that usually occur
Unusual DLL loadings
When your tool loads a custom DLL, it leaves traces in ETW Sysmon and even memory.
Named Pipes
If the tool has IPC and a pipe is created, it can be seen in the handle table and some logs.
Temporary Registry Keys
Some tools create short-lived keys for experimental config or persistence, which is what makes you get caught.
Network Artifacts
Even if there is no log file
Open routes, DNS cache, ARP cache, and socket states may be visible
Process Tree / Parent Spoofing
Many times people think that because PPID Spoofing is done, the job is done, but artifacts like Token Thread start time and Memory layout
will expose your hands and expose everything
How to clean them
If your tools load DLLs, create pipes, or manipulate the registry, you should design them to clean up after execution
Pipeline Cleanup
After work:
Close pipes
Free handles
Join threads
Delete temporary registry
50% of people do not do this simple thing
Reduce Interaction with the operating system
Less syscalls, whatever
Smaller footprint
Limit Network Indicators
Open DNS cache, socket states, and routes
They should be reset after completion
Memory Hygiene
Buffers and structures that contain behavioral metadata
should not be left unused in RAM
@reverseengine
پاکسازی رفتاری یعنی چی
همیشه فقط فایل و لاگ نیست که شما رو لو میده خیلی وقتا رفتار برنامه یه اثر جانبی تو سیستم میذاره مثل اینکه برنامه رفته یه مسیر خاص یه DLL لود کرده یه NamedPipe ساخته یا حتی یه کلید رجیستری کوتاه اضافه کرده
اینها اسمش میشه Behavioral Artifact
و بدترین چیز اینه که خیلیاش اصلا به چشم نمیاد ولی تو فارنزیک کاملا مشخصه و لو میرید
مهمترین رد پاهای رفتاری که معمولا میوفتن
Load شدن
های غیر معمولی DLL
وقتی ابزارتون یه DLL کاستوم لود میکنه
تو ETW Sysmon و حتی حافظه اثرش میمونه
Named Pipes
اگه ابزار IPC داره و pipe ساخته بشه
تو حافظه handle table و بعضی لاگها دیده میشه
Registry Keys موقتی
بعضی ابزارا برای config یا persistence آزمایشی کلید short-lived میسازن که همون باعث لو رفتنتون میشه
Network Artifacts
حتی اگر لاگ فایل وجود نداشته باشه
route
های باز شده DNS cache ARP cache و socket states ممکنه دیده بشه
Process Tree / Parent Spoofing
خیلی وقتا افراد فکر میکنن چون PPID Spoof کردن پس کار تمومه ولی artifact های مثل Token Thread start time و Memory layout
دستتون رو رو میکنه و لو میرید و همه چی افشا میشه
چطور باید پاکشون کنید
اگه ابزارای شما DLL لود میکنه pipe میسازه یا رجیستری دستکاری میکنه باید اونا رو طوری طراحی کنید که بعد از اجرا خودش cleanup کنه
Pipeline Cleanup
بعد از کارا:
pipe
ها رو ببندید
handle
ها رو free کنید
thread
ها رو join کنید
registry موقت رو حذف کنید
%50 افراد همین کارای ساده رو نمیکنن
کمکردن Interaction با سیستم عامل
هرچی syscalls کمتر
ردپا کمتر
محدود کردن Network Indicators
DNS cache، socket states و route
های باز شده
بعد از اتمام کار باید reset بشن
Memory Hygiene
Buffer
ها و ساختار هایی که حاوی metadata رفتاری هستن
نباید تو RAM بدون استفاده بشن
Cleaning up behavioral artifacts
What is behavioral cleaning?
It's not always just files and logs that give you away. Often, the program's behavior leaves a side effect on the system, such as the program going to a specific path, loading a DLL, creating a NamedPipe, or even adding a short registry key.
These are called Behavioral Artifacts.
And the worst thing is that many of them are not visible at all, but in forensics they are quite obvious and you get caught.
The most important behavioral traces that usually occur
Unusual DLL loadings
When your tool loads a custom DLL, it leaves traces in ETW Sysmon and even memory.
Named Pipes
If the tool has IPC and a pipe is created, it can be seen in the handle table and some logs.
Temporary Registry Keys
Some tools create short-lived keys for experimental config or persistence, which is what makes you get caught.
Network Artifacts
Even if there is no log file
Open routes, DNS cache, ARP cache, and socket states may be visible
Process Tree / Parent Spoofing
Many times people think that because PPID Spoofing is done, the job is done, but artifacts like Token Thread start time and Memory layout
will expose your hands and expose everything
How to clean them
If your tools load DLLs, create pipes, or manipulate the registry, you should design them to clean up after execution
Pipeline Cleanup
After work:
Close pipes
Free handles
Join threads
Delete temporary registry
50% of people do not do this simple thing
Reduce Interaction with the operating system
Less syscalls, whatever
Smaller footprint
Limit Network Indicators
Open DNS cache, socket states, and routes
They should be reset after completion
Memory Hygiene
Buffers and structures that contain behavioral metadata
should not be left unused in RAM
@reverseengine
❤2🔥1
Exploiting memory corruption vulnerabilities on Android
https://blog.oversecured.com/Exploiting-memory-corruption-vulnerabilities-on-Android
@reverseengine
https://blog.oversecured.com/Exploiting-memory-corruption-vulnerabilities-on-Android
@reverseengine
News, Techniques & Guides
Exploiting memory corruption vulnerabilities on Android
In today's blog, we'll discuss memory corruption vulnerabilities in Android apps and how they can be exploited. At the end of the article, we'll show how we found such a vulnerability in PayPal apps and what the result could be.
❤2
A foray into Linux kernel exploitation on Android
https://mcyoloswagham.github.io/linux
@reverseengine
https://mcyoloswagham.github.io/linux
@reverseengine
mcyoloswagham.github.io
A foray into Linux kernel exploitation on Android
In November of 2020, I decided to dive into the world of Android, more specifically the linux kernel. I did this because earlier in the year, around February, I broke my old phone during a skiing trip and hastily bought a cheap android phone, the Alcatel…
❤2
Hyper-V debugging for beginners 2nd edition
https://hvinternals.blogspot.com/2021/01/hyper-v-debugging-for-beginners-2nd.html
@reverseengine
https://hvinternals.blogspot.com/2021/01/hyper-v-debugging-for-beginners-2nd.html
@reverseengine
Blogspot
Hyper-V debugging for beginners. 2nd edition.
hyper-v internals
❤1
Hyper-V memory internals. EXO partition memory access
https://hvinternals.blogspot.com/2020/06/hyper-v-memory-internals-exo-partition.html
@reverseengine
https://hvinternals.blogspot.com/2020/06/hyper-v-memory-internals-exo-partition.html
@reverseengine
Blogspot
Hyper-V memory internals. EXO partition memory access
hyper-v internals
❤1
Multi-disassemblers collaboration framework for reverse engineering
https://github.com/Martyx00/CollaRE
@reverseengine
https://github.com/Martyx00/CollaRE
@reverseengine
GitHub
GitHub - Martyx00/CollaRE: Multi-tool reverse engineering collaboration solution.
Multi-tool reverse engineering collaboration solution. - Martyx00/CollaRE
❤1
How To Reverse Engineer RC4 Crypto For Malware Analysis
https://www.youtube.com/watch?v=-EQKiIbOLEc
@reverseengine
https://www.youtube.com/watch?v=-EQKiIbOLEc
@reverseengine
YouTube
How To Reverse Engineer RC4 Crypto For Malware Analysis
View our malware analysis training: https://AGDCservices.com/training/
Follow me on Twitter for RE tips and resources: https://twitter.com/AGDCservices
View our malware analysis products to aid in your RE efforts (Ghidra / python noscripts, tools, and individual…
Follow me on Twitter for RE tips and resources: https://twitter.com/AGDCservices
View our malware analysis products to aid in your RE efforts (Ghidra / python noscripts, tools, and individual…
❤1
Reverse Engineering iMessage: Leveraging the Hardware to Protect the Software
https://www.nowsecure.com/blog/2021/01/27/reverse-engineering-imessage-leveraging-the-hardware-to-protect-the-software
@reverseengine
https://www.nowsecure.com/blog/2021/01/27/reverse-engineering-imessage-leveraging-the-hardware-to-protect-the-software
@reverseengine
Nowsecure
Reverse Engineering iMessage to Help Improve Security | NowSecure
Our researcher reverse engineered Apple iMessage to explore extending it the secure messaging app to other systems. See how he fared.
❤1
ReCopilot: A Reverse Engineering Copilot for Boosting Binary Analysis with Decompiler
https://github.com/XingTuLab/recopilot
@reverseengine
https://github.com/XingTuLab/recopilot
@reverseengine
GitHub
GitHub - XingTuLab/recopilot: ReCopilot: Reverse Engineering Copilot in Binary Analysis
ReCopilot: Reverse Engineering Copilot in Binary Analysis - XingTuLab/recopilot
❤1
[Reverse Engineering Tips] — Binary Diffing
https://medium.com/malware-buddy/reverse-engineering-tips-binary-diffing-17760bd89f39
@reverseengine
https://medium.com/malware-buddy/reverse-engineering-tips-binary-diffing-17760bd89f39
@reverseengine
Medium
[Reverse Engineering Tips] — Binary Diffing
Binary diffing is a great way to visualize and spot differences in multiple samples. As a malware researcher, this is useful for…
❤1