Apóyanos

La Fundación Ideando, es una organización sin fines de lucro y funciona gracias al apoyo de personas como usted, que colaboran de manera desinteresada en beneficio de un progreso cultural y educativo con mayor oportunidad para el mundo. Presione sobre Donate y coloque el monto que quiere aportar..

domingo, 28 de enero de 2024

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 articles


Bypass Hardware Firewalls

This is just a collection of links about my DEF CON 22 presentation, and the two tools I released:

Slides:
http://www.slideshare.net/bz98/defcon-22-bypass-firewalls-application-white-lists-secure-remote-desktops-in-20-seconds

Tools:
https://github.com/MRGEffitas/Write-into-screen
https://github.com/MRGEffitas/hwfwbypass

Presentation video from Hacktivity:
https://www.youtube.com/watch?v=KPJBckmhtZ8

Technical blog post:
https://blog.mrg-effitas.com/bypass-hardware-firewalls-def-con-22/

Have fun!




More info
  1. Pentest Tools For Mac
  2. Hack Tools
  3. New Hack Tools
  4. Top Pentest Tools
  5. Hacker Tools Apk Download
  6. Pentest Tools Url Fuzzer
  7. Hacking Tools Hardware
  8. Hacking Tools Github
  9. Hacking Tools For Mac
  10. Hack Tools 2019
  11. Hacker Tools Apk Download
  12. Hacker
  13. Hack Tool Apk
  14. Hacker Hardware Tools
  15. Hacker Techniques Tools And Incident Handling
  16. Pentest Tools Download
  17. Hack And Tools
  18. Hacking App
  19. Tools Used For Hacking
  20. Underground Hacker Sites
  21. Black Hat Hacker Tools
  22. Top Pentest Tools
  23. Hacking Tools For Kali Linux
  24. Hack App
  25. What Is Hacking Tools
  26. Hack Tools
  27. Hacking Tools 2019
  28. Usb Pentest Tools
  29. Pentest Tools Website Vulnerability
  30. Pentest Tools List
  31. Hacker Tools 2019
  32. Hacking Tools Hardware
  33. Pentest Tools Framework
  34. Hack Tools Mac
  35. Tools For Hacker
  36. Hacker Tools For Ios
  37. Hacking Tools For Beginners
  38. Hacking Apps
  39. Pentest Tools Url Fuzzer
  40. Hacking Apps
  41. Hack And Tools
  42. Nsa Hack Tools
  43. Game Hacking
  44. Termux Hacking Tools 2019
  45. Pentest Tools Linux
  46. Hack Website Online Tool
  47. Pentest Tools Bluekeep
  48. Computer Hacker
  49. Termux Hacking Tools 2019
  50. Wifi Hacker Tools For Windows
  51. Game Hacking
  52. Hack Rom Tools
  53. Pentest Tools List
  54. Hack App
  55. Easy Hack Tools
  56. Pentest Tools For Mac
  57. Tools 4 Hack
  58. Hacker Techniques Tools And Incident Handling
  59. Hacking Tools
  60. Hacking Tools Name
  61. Beginner Hacker Tools
  62. Hack Tools For Mac
  63. Pentest Tools Bluekeep
  64. New Hacker Tools
  65. Pentest Automation Tools
  66. Tools For Hacker
  67. Hacking Tools For Pc
  68. Hacking Apps
  69. Hacker Tools Apk
  70. World No 1 Hacker Software
  71. Hacker Tools Mac
  72. Pentest Tools Windows
  73. Top Pentest Tools
  74. Hacker Tools Mac
  75. Hacker Tools Windows
  76. Android Hack Tools Github
  77. Github Hacking Tools
  78. Hacker Tool Kit
  79. Termux Hacking Tools 2019
  80. Hacking Tools Windows
  81. Hackers Toolbox
  82. Kik Hack Tools
  83. Hack Tools 2019
  84. Tools Used For Hacking
  85. Hack Tools Download
  86. Black Hat Hacker Tools
  87. Hack And Tools
  88. Pentest Tools Github
  89. Pentest Tools Download
  90. Hacking Apps
  91. Hacking Tools Free Download
  92. Pentest Box Tools Download
  93. Hacker Tools For Windows
  94. Hacking Tools For Games
  95. Hacker Tools For Mac
  96. Hacking Tools Download
  97. Pentest Box Tools Download
  98. Pentest Tools Review

Compartir

Bookmark and Share