sexta-feira, 28 de agosto de 2020

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 information


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

0 comentários:

Postar um comentário