« Home | Practical Dictionary Attack On IPsec IKE » | C++ Std::String Buffer Overflow And Integer Overflow » | 3069 hash passwords » | OWASP Blog Moved To Website » | Masad Clipper And Stealer - Windows Spyware Exfilt... » | Arris Cable Modem Backdoor - I'm A Technician, Tru... » | Learning Web Pentesting With DVWA Part 1: Installa... » | 2020-12-13 SUNBURST SolarWinds Backdoor Samples » | 2350 Interesting News » | 2346 Interesting News »

Reversing Some C++ Io Operations

In general decompilers are not friendly with c++ let's analyse a simple program to get familiar with it.
Let's implement a simple code that loads a file into a vector and then save the vector with following functions:

  • err
  • load
  • save
  • main


Lets identify the typical way in C++ to print to stdout with the operator "<<"


The basic_ostream is initialized writing the word "error" to the cout, and then the operator<< again to add the endl.




The Main function simply calls  "vec = load(filename)"  but the compiler modified it and passed the vector pointer as a parĂ¡meter. Then it bulds and prints "loaded  " << size << " users".
And finally saves the vector to /tmp/pwd and print "saved".
Most of the mess is basically the operator "<<" to concat and print values.
Also note that the vectors and strings are automatically deallocated when exit the function.


And here is the code:


Let's take a look to the load function, which iterates the ifs.getline() and push to the vector.
First of all there is a mess on the function definition, __return_storage_ptr is the vector.
the ifstream object ifs is initialized as a basic_ifstream and then operator! checks if it wasn't possible to open the file and in that case calls err()
We see the memset and a loop, getline read a cstr like line from the file, and then is converted to a string before pushing it to the vector. lVar1 is the stack canary value.

In this situations dont obfuscate with the vector pointer vec initialization at the begining, in this case the logic is quite clear.



The function save is a bit more tricky, but it's no more than a vector iteration and ofs writing.
Looping a simple "for (auto s : *vec)" in the decompiler is quite dense, but we can see clearly two write, the second write DAT_0010400b is a "\n"



As we see, save implememtation is quite straightforward.




More info


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