- Understand process/thread privileges
- Understand intercommunication and object duplication among processes
- Practice analyzing function call parameters and stack
- Operating Systems
- Assembly Language
- Operating System Security
In this tutorial, we show you another intriguing behavior of Max++: it removes the Max++Loader.exe from disk once it finishes its infection operations, such as modification of registry and infection of driver DLL files. The removal operation is accomplished using a series of interesting techniques: changing of process privileges, adding threads to another running process, hooking up timer events, and return oriented programming (more exactly return to libc attacks).
We will analyze the code from 0x3C1193 in this tutorial.
The key to analyzing such malicious activities is to examine the system calls placed by Max++. We have introduced the techniques and skills you need for such analysis in Tutorial 14.
2. Lab Configuration
(0) Start WinXP image in DEBUGGED mode. Now in your host system, start a windows command window and CD to "c:\Program Files\Debugging Tools for Windows (x86)" (where WinDBG is installed). Type "windbg -b -k com:pipe,port=\\.\pipe\com_12" (check the com port number in your VBox instance set up). When WinDbg initiates, types "g" (go) twice to let it continue.
(1) Now launch IMM in the WinXP instance, clear all breakpoints and hardware breakpoints in IMM (see View->Breakpoints and View->Hardware Breakpoints).
(2) Go to 0x4012DC and set a hardware breakpoint there. (why not software bp? Because that region will be self-extracted and overwritten and the software BP will be lost). Pay special attention that once you go to 0x4012DC, directly right click on the line to set hardware BP (currently it's gibberish code).
(3) PressF9 several times run to 0x4012DC. You will encounter several breakpoints before 0x4012DC. If you pay attention, they are actually caused by the int 2d tricks (explained in Tutorial 3 and 4, and 5). Simply ignore them and continue (using F9) until you hit 0x4012DC.
Figure 1 shows the code that should be able to see. As you can see, this is right before the call of RtlAddVectoredException, where hardware BP is set to break the LdrLoadDll call (see Tutorial 11 for details). At this point, the code at 0x3C24FB has not been extracted. If you go to 0x3C24FB at this moment, IMM will complain that this address is not accessible.
Figure 1: code at 0x4012DC |
Figure 2: code at 0x401407 |
(6) Now we will set a breakpoint at 0x3C1193. Goto 0x3C1193and set a SOFTWARE BREAKPOINT there. Press SHIFT+F9 to run to 0x3C1193. (You may see a warning that this is out range of the code segment, simply ignore the warning).
(Figure 3 shows the code that you should be able to see at 0x3C1193. The first instruction should be PUSH EBP, and then MOV EBP, ESP, and then SUB EBP, 384.).
Figure 3: Function 0x3C1193 |
We now briefly describe the functionality of 0x3C1193 and we leave most analysis details to you in Section 4 (challenges).
The first part of the code is shown in Figure 3. Max++ first calls a function getModuleHandleW of itself, and then it calls LdrFindEntryForAddress (its own module). Then there is a big loop from 0x3C11F1 to 0x3c1224, which follows the module list and examine the information of processes. This is done using zwQueryProcessInformation (there is an internal loop which adjusts the buffer size if the size is not enough). After several iterations, Max++ identifies a process which satisfies some criteria on parent process and children threads. In our case, the process identified is smss.exe. Then it opens a thread (think about which thread it is), and assign a bunch of privileges to the thread (See Figure 4).
Figure 4. Adding Privileges to Thread |
Figure 5. Duplicate File Object |
Figure 6. Create a New Thread in smss.exe Process |
4. Challenges
[Hint: for system functions started with "zw", the "nt" series documentation can be often found. For example, "zwDuplicateObject" has a corresponding "ntDuplicateObject"]
Challenge 1. Analyze the semantics of all function parameters and the return of getModuleHandleW call at 0x3C11A6 (see Figure 3)
Challenge 2. Analyze the semantics of all function parameters and the return of LdrFindEntryForAddress call at 0x3C11AD (see Figure 3)
Challenge 3. Analyze the semantics of all function parameters and the return of zwQuerySystemInformation call at 0x3C11F3 (see Figure 3)
Challenge 4 Summarize the function of the loop starting from 0x3C1209 to 0x3C123F which searches for a a process to inject a thread. There are some properties such a host process must satisfy. Read the code and describe these desired properties (on parent process and children threads).
Challenge 5 In Figure 4, Max++ is adding a collection of privileges to a thread? Which thread it is (which process does this thread belong to)? Try to figure it out and prove that your argument is correct.
Challenge 6 In Figure 4, Max++ is adding a collection of privileges to a thread? Analyze RtlAdjustPrivilege calls at 0x003C1297, 0x003C12A3, 0x003C12AF, 0x003C12BB, etc. List the privileges added.
Challenge 7 Analyze the function call DosPathNameToNtPathName at 0x003C12DA (in Figure 5).
Challenge 8 Analyze the function call zwOpenFile at 0x003C1331 (in Figure 5).
Challenge 9 Analyze the function call zwDuplicateObject at 0x003C1355 (in Figure 5). Where is the new object (duplicated object) stored?
Challenge 10 Analyze the function call zwDuplicateObject at 0x003C136e (in Figure 5). Which object is duplicated?
Challenge 11 Analyze the function call RtlCreateUserThread at 0x003C1390 (in Figure 6).
Challenge 12 Analyze the function call zwContextThread at 0x003C13B5 (in Figure 6).
Challenge 13 Analyze the function call zwWriteVirtualMemory at 0x003C145F (in Figure 6).
Thanks man. I am looking for this kind of step by step introductory on such a complex subject. nicely start reading from you first post. keep posting...
ReplyDeleteHey, nice site you have here! Keep up the excellent work!
ReplyDeleteFunction Point Estimation Training
Your posts is really helpful for me.Thanks for your wonderful post. I am very happy to read your post.
ReplyDeleteSEO Training in chennai|SEO Training chennai
Nice article i was really impressed by seeing this article, it was very interesting and it is very useful for Learners..
ReplyDeleteCloud Computing Training in chennai | Cloud Computing Training chennai
It helps the software developers and programmers to validate software application performance and behavior before deployment.Nice article.
ReplyDeleteVMWare Training in chennai | VMWare Training chennai
Really awesome blog. Thanks for sharing this informative blog. Currently I have completed Software Testing Training in Chennai at a reputed training institutes. If you are looking for best Software Testing Training Institutes in Chennai reach FITA located at Chennai, India.
ReplyDeleteI have been following your posts regularly. It is very informative that I share it with my students.
ReplyDeleteQTP Training Chennai
Thanks for your wonderful post. I am very happy to read your post.
ReplyDeleteThis is really informative. Thanks for sharing this article
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThanks for sharing, very informative blog.
ReplyDeleteReverseEngineering
Nice blog!!!!!!!.
ReplyDeleteReverseEngineering
good...
ReplyDeleteINTERNSHIP PROGRAM FOR BSC STUDENTS
FINAL YEAR PROJECT IDEAS FOR INFORMATION TECHNOLOGY
CCNA COURSE IN CHENNAI
ROBOTICS COURSES IN CHENNAI
INTERNSHIP IN CHENNAI FOR ECE
CCNA TRAINING IN CHENNAI
PYTHON INTERNSHIP IN CHENNAI
INDUSTRIAL VISIT IN CHENNAI
INTERNSHIP FOR CSE STUDENTS IN CHENNAI
ROBOTICS TRAINING IN CHENNAI
GREAT BLOG....
ReplyDeletePython Internship
Dotnet Internship
Java Internship
Web Design Internship
Php Internship
Android Internship
Big Data Internship
Cloud Internship
Hacking Internship
Robotics Internship
nice...
ReplyDeleteOracle Internship
R Programming Internship
CCNA Internship
Networking Internship
Artificial Intelligence Internship
Machine Learning Internship
Blockchain Internship
Sql Server Internship
Iot Internship
Data Science Internship
GREAT...
ReplyDeleteSelenium Testing Internship
Linux Internship
C Internship
CPP Internship
Embedded System Internship
Matlab Internship
good
ReplyDeleteGeteventlisteners javascript
Karl fischer titration interview questions
How to hack tp link router
T system aptitude questions
Resume for bca final year student
Test case for railway reservation system
T systems pune placement papers
Infrrd bangalore interview questions
Max number in javascript
Paypal integration in php step by step pdf
NICE POST
ReplyDeleteFREE Internship in Nagpur For Computer Engineering Students
Internship For MCA Students
Final Year Projects For Information Technology
Web Design Class
Mechanical Engineering Internship Certificate
Inplant Training For Mechanical Engineering Students
Inplant Training Certificate
Ethical Hacking Course in Chennai
Winter Internship For ECE Students
Internships For ECE Students in Bangalore
GOOD POST....
ReplyDeleteHow To Hack On Crosh
Request Letter For Air Ticket Booking To HR
Zeus Learning Aptitude Paper For Software Developer
Cimpress Interview Questions
VCB Rating
Appreciation Letter To Vendor
JS MAX Safe Integer
Why Do You Consider Yourself Suitable For The Position
How To Hack Android Phone From PC
About Bangalore Traffic Essay
great information
ReplyDeleteInternship For Aerospace Engineering
Mechanical Engineering Internships in Chennai
Robotics Courses
Kaashiv
Training Letter Format For Mechanical Engineer
Internship For BCA Student
Fake Internship Certificate
MBA Internship
Free Internship For CSE Students in Chennai
Oracle Internship 2020
ReplyDeleteexcellent....!!!
chile web hosting
colombia web hosting
croatia web hosting
cyprus web hosting
bahrain web hosting
india web hosting
iran web hosting
kazakhstan web hosting
korea web hosting
moldova web hosting
ReplyDeleteNice Blog! It is really interesting and informative..
Software Testing Training in Chennai
Software Testing Course in Bangalore
Software Testing Course in Coimbatore
Software Testing Course in Madurai
Software Testing Institute in Bangalore
Software Testing Training in Bangalore
Software Testing Training Institute in Bangalore
Ethical Hacking Course in Bangalore
Selenium Course in Bangalore
You always try to sharing such a good information with us.
ReplyDeleteNetworking Summer Training in Delhi
Summer Internship Program
Nice post, you give the clear idea of the topic and I subscribed your blog, I have some links to share here good luck keep shre.
ReplyDeleteAi & Artificial Intelligence Course in Chennai
PHP Training in Chennai
Ethical Hacking Course in Chennai Blue Prism Training in Chennai
UiPath Training in Chennai
Hi there, I found your site via Google at the
ReplyDeletesame time as looking for a comparable matter, your website came up, it
seems to be good. I’ve bookmarked it in my google bookmarks.
Here is the link of Artweaver Plus Free Download:
https://softserialskey.com/artweaver-plus-free-crack/
It’s a complete painting tool with a huge collection of descriptive realistic brushes that allow you to paint and experiment creatively.
Đại lý vé máy bay Aivivu, tham khảo
ReplyDeletemua ve may bay di my
vé máy bay từ mỹ về việt nam giá bao nhiêu
bay từ anh về việt nam
vé máy bay từ pháp về việt nam
Thankyou so much for sharing this info
ReplyDeletewedding Photographer in Ahmedabad
wedding Photographer in Bhopal
Dooh in India
David Forbes is president of Alliance Marketing Associates IncIamLinkfeeder IamLinkfeeder IamLinkfeeder IamLinkfeeder IamLinkfeeder IamLinkfeeder IamLinkfeeder IamLinkfeeder IamLinkfeeder IamLinkfeeder
ReplyDeleteExcellent post, I have to thank for this. It helps me a lot to enhance my knowledge. I truly like your way of blogging. I bookmarked it to my bookmark website list and will be checking back soon. thanks this time to take advantage of Camera Inspection Service in San Diego visit for more details.
ReplyDeleteAppreciate you sharing, great article.Much thanks again. Really Cool.
ReplyDeletejava training
java online training
It was wonderfull reading your article. Great writing style # BOOST Your GOOGLE RANKING.It’s Your Time To Be On #1st Page Our Motive is not just to create links but to get them indexed as will Increase Domain Authority (DA).We’re on a mission to increase DA PA of your domain High Quality Backlink Building Service 1000 Backlink at cheapest 50 High Quality Backlinks for just 50 INR 2000 Backlink at cheapest 5000 Backlink at cheapest
ReplyDeletelike to retrieve it,looking ahead to more subsidiary update and that i Already read your current post its brilliant thanks. VoiceMod Pro Full Version
ReplyDeletelike to retrieve it,looking ahead to more subsidiary update and that i Already read your current post its brilliant thanks. VoiceMod Pro Cracked
ReplyDeletekralbet
ReplyDeletebetpark
tipobet
slot siteleri
kibris bahis siteleri
poker siteleri
bonus veren siteler
mobil ödeme bahis
betmatik
İ4H
thanks for sharing this wonder ful Information
ReplyDeleteselenium training in hyderabad
Thanks for sharing...Celebrity photographers in india
ReplyDeleteAmong the Top ivf centre in delhi, Nandi IVF Hospital stands out for its advanced reproductive technologies and experienced team of fertility specialists. With a reputation for high success rates, state-of-the-art facilities, and personalized care, Nandi IVF Hospital has become a preferred choice for couples seeking fertility treatment.
ReplyDeleteThe centre offers comprehensive services, including in vitro fertilization (IVF), intrauterine insemination (IUI), egg freezing, and more. Their commitment to excellence and patient-centric approach make a leading destination for individuals on their journey towards parenthood.
I really need to to thank you for this good read!! I certainly loved every bit of it.
ReplyDeleteAwesome updates! Continue blogging Hoping to your next post here.
ReplyDeleteThis content data gives truly quality and unique information. Thanks.
ReplyDeleteI am hoping to view the same high-grade blog posts. Keep on writing!
ReplyDelete