You may find interesting how the bypass works. It is a neat piece of hacking, in my humble opinion.
To have a successful login, both following functions should return "true" (login.php, #75)
if (validate_login($username,$passwd) && authenticate()){The first one (common.php, #262) verifies username/password size and format.
[…]
}
As you can see, it accepts a username containing a-zA-Z0-9._- chars only.
function validate_login($username, $password)On the other hand, the second function executes a command line tool and checks for error messages. Since Oracle Backup server command line tools require authentication in order to be successfully executed, the developers decided to use this application behavior in order to check whether the user has got a valid session. No comment, please!
{
global $status_msg;
if (strlen($username) > 128 || preg_match("/[^a-zA-Z0-9._-]/", trim($username)))
{
$status_msg[] = "Error: login failed";
return false;
}
if (strlen($password) > 16)
{
$status_msg[] = "Error: login failed";
return false;
}
return true;
}
// Check for a failed login.And here a question: “Can we tamper a valid username, according to the specified format, in order to properly execute the binary without triggering errors?” Sure, we do. Check the exploit and find the answer!
if (strstr($msg[0], " login incorrect") ||
strstr($msg[0], "obtool:") ||
strstr($msg[0], "Obtool:") ||
strstr($msg[0], "Error:") ||
strstr($msg[0], "sh:"))
[…]
Great work Luca!!
ReplyDeleteNow it makes sense, the '--' in the username field is causing the command line tool to return with no errors right? I think posting the section of the code calling the command-line tool might provide more insight.
Nice to see you here!
ReplyDeleteThe idea is to inject a fake option (e.g. –-fake) in order to get the usage screen which does not contain strings as “Error”, “login incorrect”, etc. In this case, the username matches the format as well as the “authenticate()” function does not return errors.
Cheers,
Luca
This comment has been removed by a blog administrator.
ReplyDelete