Sunday, January 28, 2024

Reversing Pascal String Object

There are many goodware and malware developed in pascal, and we will see that the binary generated by the pascal compilers is fascinating, not only because the small and clean generated binaries, or the  clarity of the pascal code, but also the good performance. In Linux we have Lazarus which is a good free IDE like Delphi and Kylix the free pascal IDE for windows.

The program:

program strtest;

var
  cstr:  array[0..10] of char;
  s, s2:  ShortString;

begin
  cstr := 'hello world';
  s  := cstr;
  s2 := 'test';
  
  WriteLn(cstr + ' ' + s + ' ' + s2);
end.


We are going to compile it with freepascal and lazarus, and just the binary size differs a lot:

lazarus          242,176 btytes  845 functions
freepascal       32,256 bytes   233 functions
turbopascal      2,928 bytes     80 functions  (wow)

And surprisingly turbopascal binaries are extremely light.
Lets start with lazarus:




Logically it imports from user32.dll some display functions, it also import the kernel32.dll functions and suspiciously the string operations of oleaut32.dll 


And our starting point is a function called entry that calls the console initialization and retrieve some console configurations, and then start a labyrinth of function calls.



On functions 10000e8e0 there is the function that calls the main function.

I named execute_param2 because the second param is a function pointer that is gonna be executed without parameters, it sounds like main calling typical strategy.
And here we are, it's clearly the user code pascal main function.


What it seems is that function 100001800 returns an string object, then is called its constructor to initialize the string, then the string is passed to other functions that prints it to the screen.

This function executes the method 0x1c0 of the object until the byte 0x89 is a null byte.
What the hell is doing here?
First of all let's create the function main:


Simply right button create function:

After a bit of work on Ghidra here we have the main:


Note that the struct member so high like 0x1b0 are not created by default, we should import a .h file with an struct or class definition, and locate the constructor just on that position.

The mysterious function was printing byte a byte until null byte, the algorithm the compiler implemented in asm is not as optimized as turbopascal's.

In Windbg we can see the string object in eax after being created but before being initialized:












Just before executing the print function, the RCX parameter is the string object and it still identical:


Let's see the constructor code.
The constructor address can be guessed on static walking the reverse-cross-references to main, but I located it in debugging it in dynamic analysis.


The constructor reads only a pointer stored on the string object on the position 0x98.

And we have that the pointer at 0x98 is compared with the address of the literal, so now we know that this pointer points to the string.
The sentence *string_x98 = literal confirms it, and there is not memory copy, it only points reusing the literal.



Freepascal

The starting labyrinth is bigger than Lazarus so I had to begin the maze from the end, searching the string "hello world" and then finding the string references:


There are two ways to follow the references in Ghidra, one is [ctrl] + [shift] + F  but there is other trick which is simply clicking the green references texts on the disassembly.

At the beginning I doubted and put the name possible_main, but it's clearly the pascal user code main function.




The char array initialization Is converted by freepascal compiler to an runtime initialization using mov instructions.

Reducing the coverage on dynamic we arrive to the writeln function:


EAX helds  a pointer to a struct, and the member 0x24 performs the printing. In this cases the function can be tracked easily in dynamic executing the sample.

And lands at 0x004059b0 where we see the WriteFile, the stdout descriptor, the text and the size supplied by parameter.


there is an interesting logic of what happens if WriteFile() couldn't write all the bytes, but this is other scope.
Lets see how this functions is called  and how text and size are supplied to figure out the string object.



EBX helds the string object and there are two pointers, a pointer to the string on 0x18 and the length in 0x18, lets verify it on windbg.


And here we have the string object, 0x0000001e is the length, and 0x001de8a68 is the pointer.


Thanks @capi_x for the pascal samples.

Related word


  1. Hacking Tools Free Download
  2. Hack Tools 2019
  3. Hacking Tools Free Download
  4. Pentest Tools Windows
  5. Pentest Tools Find Subdomains
  6. Hacking Tools For Windows Free Download
  7. Hacker Tools Free
  8. World No 1 Hacker Software
  9. Hack Tools Online
  10. Hacker Tools Linux
  11. Hacker
  12. Pentest Tools Apk
  13. Hacker Tool Kit
  14. Hacker Tools Mac
  15. Hack Tools Download
  16. Free Pentest Tools For Windows
  17. Pentest Tools Windows
  18. Android Hack Tools Github
  19. Pentest Tools Apk
  20. Hacker Tools 2020
  21. Tools For Hacker
  22. Nsa Hack Tools
  23. Hacking Tools Usb
  24. Hacker Tools Apk Download
  25. Hacking Tools Hardware
  26. Hacker Search Tools
  27. Hacker Hardware Tools
  28. Kik Hack Tools
  29. Hackers Toolbox
  30. Pentest Tools For Android
  31. Hack Rom Tools
  32. Easy Hack Tools
  33. Tools Used For Hacking
  34. Hack Tools For Mac
  35. Growth Hacker Tools
  36. Hacking Tools Github
  37. Hacking Tools For Games
  38. Hacker Tools For Ios
  39. Hack Tools Pc
  40. Tools 4 Hack
  41. Hacker Search Tools
  42. Pentest Tools Port Scanner
  43. Hacker Search Tools
  44. How To Make Hacking Tools
  45. Hacking Tools Kit
  46. Hacking App
  47. Pentest Tools Kali Linux
  48. Pentest Tools For Android
  49. Hacking Tools For Windows
  50. Hack And Tools
  51. Pentest Tools Review
  52. Hack Tools For Windows
  53. Pentest Tools Android
  54. Hacker Tools Linux
  55. Hacker Tools Online
  56. Pentest Tools Android
  57. Pentest Recon Tools
  58. Pentest Tools For Android
  59. Hack Tool Apk No Root
  60. Hack Tools
  61. Hacker Security Tools
  62. Blackhat Hacker Tools
  63. Black Hat Hacker Tools
  64. Hacker Tools
  65. Hacker Tools Github
  66. Hacker Search Tools
  67. Nsa Hack Tools
  68. Hacker Tools Apk Download
  69. Pentest Tools Android
  70. Hacker Tools Apk Download
  71. Hacker Techniques Tools And Incident Handling
  72. Hack Tool Apk
  73. Tools For Hacker
  74. Pentest Tools Website
  75. Pentest Tools Review
  76. New Hacker Tools
  77. Hacker Tools 2020
  78. Hack Tools For Ubuntu
  79. Pentest Tools Website Vulnerability
  80. Hacker Tools 2020
  81. Hack Tools Mac
  82. Hack And Tools
  83. Hacker Search Tools
  84. Pentest Tools List
  85. Pentest Tools Nmap
  86. Tools For Hacker
  87. Beginner Hacker Tools
  88. Pentest Tools Online
  89. Hack Rom Tools
  90. Pentest Automation Tools
  91. Pentest Box Tools Download
  92. Hack Rom Tools
  93. Hack Tools For Pc
  94. Hack Tools Online
  95. Hack Tools For Mac
  96. Wifi Hacker Tools For Windows
  97. Pentest Tools Kali Linux
  98. Hacker Tools Free
  99. Hacker Tools Free Download
  100. Pentest Tools For Mac
  101. Pentest Tools Review
  102. Hacking Tools 2019
  103. Hacker Tools Hardware
  104. Pentest Recon Tools
  105. Hacking Tools Hardware
  106. Hacks And Tools
  107. Tools 4 Hack
  108. Hacker Tools Online
  109. Pentest Tools Nmap
  110. Hacker Tool Kit
  111. Hacker Search Tools
  112. Hacker Tools For Ios
  113. Pentest Tools Windows
  114. Hack Tools
  115. Best Pentesting Tools 2018
  116. Hacker Tools Github
  117. Hacker Tools For Mac
  118. Pentest Tools Linux
  119. Hackrf Tools
  120. Pentest Tools
  121. Hack Tools For Pc
  122. Hacking Tools Free Download
  123. Pentest Tools Tcp Port Scanner
  124. Hacking Tools For Games
  125. Hacking Tools For Beginners
  126. Blackhat Hacker Tools
  127. Pentest Tools For Ubuntu
  128. Hacker Tools
  129. Hacking Tools For Games
  130. Hacking Tools Hardware
  131. Wifi Hacker Tools For Windows
  132. Hacking Tools And Software
  133. Hacking Tools Software
  134. Hacker Tools Software
  135. Pentest Tools For Ubuntu
  136. Pentest Tools Framework
  137. Hack Tools Pc
  138. Hacker Tools For Pc
  139. Hacker Tools Free
  140. Hacking Tools Download
  141. Hack And Tools
  142. Hacking Tools For Windows 7
  143. Pentest Automation Tools
  144. Hak5 Tools
  145. Pentest Tools Open Source
  146. Hacker Tools Linux
  147. Hacker Tools For Windows
  148. Pentest Tools For Mac

Learning Resources For Hacking And Pentesting


In this article, I'm going to provide you a list of resources which I have found very useful. I don't remember all of them from top of my head so I might miss some. This list will be updated on usual basis. Hope you'll find some good stuff to learn. If you have got suggestions leave them down below in the comments section.

Free Hands on Labs:

1. Hack The Box - live machines to hack your way around. Besides boxes they have awesome challenges and great labs to try out.
2. TryHackMe - great way to learn pentesting while doing it. Lots of machines to hack and lots of ground to cover.
3. Portswigger Web Security Academy - learn web application pentesting.

Free Training (Mostly Introductory stuff):

1. Tenable University - training and certification on Nessus etc.
2. Palo Alto Networks - Palo Alto Networks offers an abundance of resources to prepare for there certifications. The training is free but the exams cost.
3. Open P-TECH - has an introductory course on Cybersecurity Fundamentals.
4. IBM Security Learning Academy - has many courses but focused on IBM security services and 
products.
5. Cisco Networking Academy - not all courses are free but Introduction to Cybersecurity and Cybersecurity Essentials are free.
6. AWS Training and Certification - has some free cloud security training courses.
7. Metasploit Unleashed - Free Online Ethical Hacking Course - Offensive Security's free online course on metasploit.
8. Coursera and Edx - you already know about them.

Blogs:

1. HackTricks - This is simply an awesome blog just visit it and you'll fall in love.
2. pentestmonkey - I visit it most of the time for one-liner reverse shells they are awesome.

Writeups:

1. 0xdf

YouTube:

1. ippsec - an awesome YouTube channel with tons of information in every video. New video comes out weekly as soon as the machine on hackthebox expires. https://ippsec.rocks for video searching
2. xct - short walkthroughs on hackthebox machines.
3. Cristi Vlad - advice and content on pentesting and python.
4. LiveOverflow - reverse engineering on steroids.
5. SANS Pen Test Training - SANS institute webinars and talks.
6. VbScrub - great pentesting videos.
7. BinaryAdventure - great pentesting and reverse engineering videos.
8. GynvaelEN - great videos and talks about CTFs and pentesting.

GitHub Repos:

1. PayloadsAllTheThings - heaven of hackers.
2. Pentest Monkey - reverse shells and more.
Related word

Samurai: Web Testing Framework


"The Samurai Web Testing Framework is a live linux environment that has been pre-configured to function as a web pen-testing environment. The CD contains the best of the open source and free tools that focus on testing and attacking websites. In developing this environment, we have based our tool selection on the tools we use in our security practice. We have included the tools used in all four steps of a web pen-test." read more...


Website: http://samurai.inguardians.com

Related word


Saturday, January 27, 2024

Best Hacking Tools

      MOST USEFUL HACKING TOOL

1-Nmap-Network Mapper is popular and free open source hacker's tool.It is mainly used for discovery and security auditing.It is used for network inventory,inspect open ports manage service upgrade, as well as to inspect host or service uptime.Its advantages is that the admin user can monitor whether the network and associated nodes require patching.

2-Haschat-It is the self-proclaimed world's fastest password recovery tool. It is designed to break even the most complex password. It is now released as free software for Linux, OS X, and windows.


3-Metasploit-It is an extremely famous hacking framework or pentesting. It is the collection of hacking tools used to execute different tasks. It is a computer severity  framework which gives the necessary information about security vulnerabilities. It is widely used by cyber security experts and ethical hackers also.

4-Acutenix Web Vulnerability Scanner- It crawls your website and monitor your web application and detect dangerous SQL injections.This is used for protecting your business from hackers.


5-Aircrack-ng - This tool is categorized among WiFi hacking tool. It is recommended for beginners  who are new to Wireless Specefic Program. This tool is very effective when used rightly.


6-Wireshark-It is a network analyzer which permit the the tester to captyre packets transffering through the network and to monitor it. If you would like to become a penetration tester or cyber security expert it is necessary to learn how to use wireshark. It examine networks and teoubleshoot for obstacle and intrusion.


7-Putty-Is it very beneficial tool for a hacker but it is not a hacking tool. It serves as a client for Ssh and Telnet, which can help to connect computer remotely. It is also used to carry SSH tunneling to byepass firewalls. So, this is also one of the best hacking tools for hackers.


8-THC Hydra- It is one of the best password cracker tools and it consist of operative and highly experienced development team. It is the fast and stable Network Login Hacking Tools that will use dictonary or bruteforce attack to try various combination of passwords against in a login page.This Tool is also very useful for facebook hacking , instagram hacking and other social media platform as well as computer folder password hacking.


9-Nessus-It is a proprietary vulnerability scanner developed by tennable Network Security. Nessus is the world's most popular vulnerability scanner according to the surveys taking first place in 2000,2003,2006 in security tools survey.


10-Ettercap- It is a network sniffing tool. Network sniffing is a computer tool that monitors,analyse and defend malicious attacks with packet sniffing  enterprise can keep track of network flow. 


11-John the Ripper-It is a free famous password cracking pen testing tool that is used to execute dictionary attacks. It is initially developed for Unix OS. The Ripper has been awarded for having a good name.This tools can also be used to carry out different modifications to dictionary attacks.


12-Burp Suite- It is a network vulnerability scanner,with some advance features.It is important tool if you are working on cyber security.


13-Owasp Zed Attack Proxy Project-ZAP and is abbreviated as Zed  Attack Proxy is among popular OWASP project.It is use to find vulnerabilities in Web Applications.This hacking and penetesting tool is very easy to use  as well as very efficient.OWASP community is superb resource for those people that work with Cyber Security.


14-Cain & Abel-It is a password recovery tool for Microsoft Operating System. It allow easy recovery of various kinds of passwords by sniffing the networks using dictonary attacks.


15-Maltego- It is a platform that was designed to deliver an overall cyber threat pictures to the enterprise or local environment in which an organisation operates. It is used for open source intelligence and forensics developed by Paterva.It is an interactive data mining tool.

These are the Best Hacking Tools and Application Which are very useful for penetration testing to gain unauthorized access for steal crucial data, wi-fi hacking , Website hacking ,Vulnerability Scanning and finding loopholes,Computer hacking, Malware Scanning etc.

This post is only for educational purpose to know about top hacking tools which are very crucial for a hacker to gain unauthorized access. We are not responsible for any type of crime.





Continue reading
  1. Hack Tools Github
  2. Pentest Tools Website
  3. Pentest Tools For Mac
  4. Pentest Tools Windows
  5. Black Hat Hacker Tools
  6. Game Hacking
  7. Hack Tool Apk
  8. Hacking Tools For Games
  9. Hacking Tools Mac
  10. Pentest Tools Port Scanner
  11. Pentest Tools For Mac
  12. Hacking App
  13. Hacker Tools Online
  14. How To Hack
  15. Hacking Tools 2019
  16. Hack Tools For Pc
  17. Hack Tools Github
  18. Computer Hacker
  19. Hacker Tools For Windows
  20. Pentest Tools Linux
  21. Hacking Tools Name
  22. Pentest Tools Github
  23. Hacker Tools Hardware
  24. Hacker Tools Mac
  25. Hack Tools Download
  26. Hacker Tools Github
  27. Hacker Tools Free
  28. Blackhat Hacker Tools
  29. Github Hacking Tools
  30. Hacker Tools Hardware
  31. Hackers Toolbox
  32. Pentest Tools For Ubuntu
  33. Pentest Tools Android
  34. How To Make Hacking Tools
  35. Hacking Tools For Games
  36. Hacking Tools For Pc
  37. Hacker
  38. Hacker Tools Apk Download
  39. Hacker Tools Apk
  40. Ethical Hacker Tools
  41. Hack Tool Apk No Root
  42. Free Pentest Tools For Windows
  43. Wifi Hacker Tools For Windows
  44. Kik Hack Tools
  45. Pentest Tools Android
  46. Bluetooth Hacking Tools Kali
  47. Hack Tool Apk No Root
  48. Pentest Tools Open Source
  49. Pentest Box Tools Download
  50. Pentest Automation Tools
  51. Hack Tools For Pc
  52. Hack Apps
  53. Hacker Tools For Mac
  54. Pentest Tools For Mac
  55. Hacker Tools List
  56. Pentest Tools Port Scanner
  57. Hacker Tools Apk
  58. Best Hacking Tools 2019
  59. Hacks And Tools
  60. Hacking Tools For Pc
  61. Hacking Tools Pc
  62. Hack Tools 2019
  63. Pentest Tools Linux
  64. Pentest Tools Port Scanner
  65. How To Install Pentest Tools In Ubuntu
  66. Hacking App
  67. What Are Hacking Tools
  68. Hack Rom Tools
  69. Hacking Tools For Windows Free Download
  70. How To Hack
  71. Hacker Tools Apk
  72. Hacker
  73. Hacking Tools Name
  74. Hacking App
  75. Hacker Tools For Ios
  76. Hacker Tools Hardware
  77. Easy Hack Tools
  78. Pentest Tools Open Source
  79. Hacker Tools Free
  80. Hack Tools Online
  81. Hacking Tools For Pc
  82. Hack Tools For Ubuntu
  83. Hacking Tools For Windows 7
  84. Hackrf Tools
  85. Hack Tools Online
  86. Hacking App
  87. New Hacker Tools
  88. Android Hack Tools Github
  89. Hacking Tools Online
  90. Beginner Hacker Tools
  91. Pentest Tools Linux
  92. Hack And Tools
  93. Hacker Tools For Ios
  94. Hack Tools 2019
  95. Hacker Tools Linux
  96. Wifi Hacker Tools For Windows
  97. Top Pentest Tools
  98. Pentest Tools
  99. Pentest Tools Apk
  100. Pentest Tools For Android
  101. Hack Tools Mac
  102. Hack Tools Download
  103. Hacking Tools Mac
  104. Hacker Tools Linux
  105. Hacker Tools List
  106. Hacking Tools For Mac
  107. Wifi Hacker Tools For Windows
  108. Game Hacking
  109. Hacker Tools Linux
  110. Hacking Tools For Games
  111. Tools For Hacker
  112. Hacking Tools Github
  113. Pentest Tools Open Source
  114. Pentest Tools Windows
  115. Pentest Tools Url Fuzzer
  116. Hacking Tools Free Download
  117. New Hacker Tools
  118. Hacker Tool Kit
  119. Hacking Tools For Games
  120. Usb Pentest Tools
  121. Hack Tools For Windows
  122. Blackhat Hacker Tools
  123. Hacker Tools Free Download
  124. Install Pentest Tools Ubuntu
  125. Tools 4 Hack
  126. Hacking Tools 2020
  127. Android Hack Tools Github
  128. Hackers Toolbox
  129. Hack Tools Pc