Wednesday, May 31, 2023

Hacking Windows 95, Part 1

During a CTF game, we came across very-very old systems. Turns out, it is not that easy to hack those dinosaur old systems, because modern tools like Metasploit do not have sploits for those old boxes and of course our "133t h4cking skillz" are useless without Metasploit... :)

But I had an idea: This can be a pretty good small research for fun.

The rules for the hack are the following:
  1. Only publicly available tools can be used for this hack, so no tool development. This is a CTF for script bunniez, and we can't haz code!
  2. Only hacks without user interaction are allowed (IE based sploits are out of scope).
  3. I need instant remote code execution. For example, if I can drop a malware to the c: drive, and change autoexec.bat, I'm still not done, because no one will reboot the CTF machine in a real CTF for me. If I can reboot the machine, that's OK.
  4. I don't have physical access.
I have chosen Windows 95 for this task. First, I had to get a genuine Windows 95 installer, so I visited the Microsoft online shop and downloaded it from their official site.

I installed it in a virtualized environment (remember, you need a boot floppy to install from the CD), and it hit me with a serious nostalgia bomb after watching the installer screens. "Easier to use", "faster and more efficient", "high-powered performance", "friendly", "intuitive interface". Who does not want that? :)






Now that I have a working Windows 95 box, setting up the TCP/IP is easy, let's try to hack it!

My first tool is always nmap. Let's scan the box! Below I'm showing the interesting parts from the result:

PORT      STATE           SERVICE       VERSION 139/tcp   open            netbios-ssn 137/udp   open|filtered   netbios-ns 138/udp   open|filtered   netbios-dgm Running: Microsoft Windows 3.X|95 OS details: Microsoft Windows for Workgroups 3.11 or Windows 95 TCP Sequence Prediction: Difficulty=25 (Good luck!) IP ID Sequence Generation: Broken little-endian incremental 

The first exciting thing to note is that there is no port 445! Port 445 is only since NT 4.0. If you check all the famous windows sploits (e.g., MS03-026, MS08-067), all of them use port 445 and named pipes. But there are no named pipes on Windows 95!

Because I'm a Nessus monkey, let's run a free Nessus scan on it!

Only one critical vulnerability found:
Microsoft Windows NT 4.0 Unsupported Installation Detection

Thanks for nothing, Nessus! But at least it was for free.

Next, I tried GFI Languard, nothing. It detected the machine as Win95, the opened TCP port, and some UDP ports as open (false-positive), and that's all...

Let's try another free vulnerability scanner tool, Nexpose. The results are much better:
  • CIFS NULL Session Permitted  
  • Weak LAN Manager hashing permitted
  • SMB signing not required
  • Windows 95/98/ME Share Level Password Bypass   
  • TCP Sequence Number Approximation Vulnerability  
  • ICMP netmask response
  • CIFS Share Readable By Everyone
I think the following vulnerabilities are useless for me at the moment:
  • Weak LAN Manager hashing permitted - without user interaction or services looking at the network, useless (I might be wrong here, will check this later)
  • TCP Sequence Number Approximation Vulnerability - not interesting
  • ICMP netmask response - not interesting
  • CIFS Share Readable By Everyone - unless there is a password in a text file, useless
But we have two interesting vulns:
  • CIFS NULL Session Permitted  - this could be interesting, I will check this later ...
  • Windows 95/98/ME Share Level Password Bypass - BINGO!
Let me quote Nexpose here:

"3.2.3 Windows 95/98/ME Share Level Password Bypass (CIFS-win9x-onebyte-password)

A flaw in the Windows 95/98/ME File and Print Sharing service allows unauthorized users to access file and print shares by sending the first character of the password. Due to the limited number of attempts required to guess the password, brute force attacks can be performed in just a few seconds.

Established connection to share TEST with password P."

The vulnerability description at MS side:

For example if the password is "Password" (without quotes) and the client sends the password "P" (without quotes) and the length of 1, the client is authenticated. To find the rest of the password, the attacker increments the length to 2 and starts guessing the second letter until he reaches "PA" and gets authenticated again. As share passwords in Windows 95 are not case sensitive, "Pa" and "PA" will also be accepted. The attacker can continue to increment the length and guessing the next letter one-by-one until he gets the full "PASSWORD" (as the maximum length is 8 characters).

I believe all characters between ALT+033 and ALT+255 can be used in the share password in Windows 95, but as it is case insensitive, we have 196 characters to use, and a maximum length of 8 characters. In worst case this means that we can guess the full password in 1568 requests. The funny thing is that the share password is not connected to (by default) any username/account, and it cannot be locked via brute force.

Luckily there is a great tool which can exploit this vulnerability:

Let's check this tool in action:


W00t w00t, it brute forced the password in less then 2 seconds!

Looking at a wireshark dump we can see how it is done:


As you can see, in the middle of the dump we can see that it already guessed the part "PASS" and it is brute-forcing the fifth character, it founds that "W" is the correct fifth character, and starts brute-forcing the sixth character.

If we are lucky with the CTF, the whole C:\ drive is shared with full read-write access, and we can write our team identifier into the c:\flag.txt. But what if we want remote code execution? Stay tuned, this is going to be the topic of the next part of this post.

Related articles


C++ Std::Condition_Variable Null Pointer Derreference


This story is about a bug generated by g++ and clang compilers (at least)
The condition_variables is a feature on the standard library of c++ (libstdc++), when its compiled statically a weird asm code is generated.


Any example on the link below will crash if its compiled statically:
 https://en.cppreference.com/w/cpp/thread/condition_variable



In this case the condition_variable.wait() crashed, but this happens with other methods, a simple way to trigger it:




If this program is compiled dynamically the crash doesn't occur:

Looking the dissasembly there is a surprise created by the compiler:


Compilers:
    g++  9.2.1+20200130-2
    clang++ v9

Both compilers are generating the "call 0x00"

If we check this call in a dynamic compiled:




The implementation of condition_variable in github:
https://github.com/gcc-mirror/gcc/blob/b7c9bd36eaacac42631b882dc67a6f0db94de21c/libstdc%2B%2B-v3/include/std/condition_variable


The compilers can't copile well this code in static,  and same happens on  other condition_variable methods.
I would say the _lock is being assembled improperly in static, is not exacly a null pointer derreference but the effects are the same, executing code at address 0x00 which on linux is a crash on most of cases.

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

$$$ Bug Bounty $$$

What is Bug Bounty ?



A bug bounty program, also called a vulnerability rewards program (VRP), is a crowdsourcing initiative that rewards individuals for discovering and reporting software bugs. Bug bounty programs are often initiated to supplement internal code audits and penetration tests as part of an organization's vulnerability management strategy.




Many software vendors and websites run bug bounty programs, paying out cash rewards to software security researchers and white hat hackers who report software vulnerabilities that have the potential to be exploited. Bug reports must document enough information for for the organization offering the bounty to be able to reproduce the vulnerability. Typically, payment amounts are commensurate with the size of the organization, the difficulty in hacking the system and how much impact on users a bug might have.


Mozilla paid out a $3,000 flat rate bounty for bugs that fit its criteria, while Facebook has given out as much as $20,000 for a single bug report. Google paid Chrome operating system bug reporters a combined $700,000 in 2012 and Microsoft paid UK researcher James Forshaw $100,000 for an attack vulnerability in Windows 8.1.  In 2016, Apple announced rewards that max out at $200,000 for a flaw in the iOS secure boot firmware components and up to $50,000 for execution of arbitrary code with kernel privileges or unauthorized iCloud access.


While the use of ethical hackers to find bugs can be very effective, such programs can also be controversial. To limit potential risk, some organizations are offering closed bug bounty programs that require an invitation. Apple, for example, has limited bug bounty participation to few dozen researchers.
More information