Skip to main content

Pwning a thin client in less than two minutes



Have you ever encountered a zero client or a thin client? It looks something like this...

If yes, keep reading below, if not, then if you encounter one, you know what you can do if you read below...

The model above is a T520, produced by HP - this model and other similar models are typically employed to support a medium/large VDI (Virtual Desktop Infrastructure) enterprise.

These clients run a Linux-based HP ThinPro OS by default and I had a chance to play with image version T6X44017 in particular, which is fun to play with it, since you can get a root shell in a very short time without knowing any password...

Normally, HP ThinPro OS interface is configured in a kiosk mode, as the concept of a thin/zero client is based on using a thick client to connect to another resource. For this purpose, a standard user does not need to authenticate to the thin client per se and would just need to perform a connection - e.g. VMware Horizon View. The user will eventually authenticate through the connection.

The point of this blog post is to demonstrate that a malicious actor can compromise such thin clients in a trivial and quick way provided physical access, a standard prerequisite in an attack against a kiosk.

During my testing, I have tried to harden as much as possible the thin client, with the following options:




I did not set the "Allow user to lock screen" to simulate a scenario where users can use any thin-clients (kiosk style). However, I have also noticed that the default password for the account "user" is "user", so if you find an environment where they enforce account lockout, you can try that password directly (it is very often unchanged...)

I also set a password for the administrator's view, so when a user attempts to switch to the admin view, a password would be required.


In this scenario, the standard user does not know this password and should only be able to use a single VMware Horizon View pre-configured connection, as shown below:


However, I have found out that unless there is user lockout enabled, then it is possible to get a root shell following the steps below:

- Select the connection profile, and edit the profile (if it auto-starts, then you should cancel the connection)

- A new window with a form is presented to you - fill the server field with dummy data and then click on the General options

- Perform the attack to "escape" from the ThinPro Control Center kiosk by entering under "Command Line Arguments": && xterm



- Click Ok to save the new "VMware Horizon View" profile

- Click on new "VMware Horizon View" profile and the connection will timeout/fail, as dummy data was entered. However, when you close/cancel the window, the xterm window will be spawn

- You have bash shell access to the HP Zero client

The user id is user, so no root yet.



However, if you check sudo -ll you see that by default, the account user can perform a lot of commands as root without the need to enter a password. The output of sudo is included in this pastebin and an exerpt below:

[SNIP]

Sudoers entry:
    RunAsUsers: root
    Commands:
NOPASSWD: /usr/bin/hpobl

[SNIP]

The most interesting command I have found is: /usr/bin/hpobl

This command allows access to the HP Easy Setup Wizard panel. Through this one, it is possible to change settings. However, in this scenario, you do not know any password, so you must find a way to get a root shell from this Wizard panel.


By going directly to the last step "Thank you" (all the previous steps can be ignored for the lolz), then click on the link - this will spawn Firefox to load the link you just clicked.



At this stage, you have launched HP Easy Setup Wizard as root and Firefox process is also launched as root. One elegant option to get a shell of Firefox is to set Firefox's external mail handler - Edit / Preferences / Applications / Mailto - and point it to /usr/bin/xterm



Then you just need to point a tab to: mailto:email@address.com and you will then be gratified with a root shell:



Here is a video of the entire attack which takes less than two minutes, in respect of the title of this blog post (in reality, the title was "...in less that one minute", but couldn't do it in that time frame lol...if you do it in less than one minute let me know...):



So what's the catch?

If you are performing a penetration testing against a VDI, look for quick wins as this one... if you are responsible for VDI, then consider that those machines can be compromised very easily - a soft key logger will be enough to get credentials to a Windows domain... also, check what configuration is enforced on the thin-client itself. It might even be more relaxed than the one considered in this scenario.

If you like kiosks and more in particular you like to break them, then you absolutely need to try: http://ikat.ha.cked.net/ . Greetz to Paul Craig, the "self-proclaimed" king of kiosks! ;-)

I haven't tried other HP Thin Pro images yet, but it might be possible that the attack shown in this blog also affects versions earlier than T6X44017.

If you find other ways to bypass HP ThinPro OS, please let me know.

Comments

  1. Gotta wonder if it calls Firefox with a full path.. if not, you can shave off some steps by tampering with your environment possibly...

    ReplyDelete
  2. &&xterm can be changed to &&firefox to shave off 20 seconds.

    ReplyDelete
    Replies
    1. you can directly do && /usr/bin/hpobl and then get to HP Easy Setup Wizard directly... ;-) I did that way in the video to show the priv escalation process ;-)

      Delete

Post a Comment

Popular posts from this blog

TrendMicro ScanMail for Microsoft Exchange (SMEX) predictable session token - CVE-2015-3326

It's time for another advisory ( CVE-2015-3326 ), a simple one, for a vulnerability which can be found quickly and trivially. For those of you who just want to give a glance at the post, I suggest to directly watch the picture which says it all! The following vulnerability was discovered on TrendMicro SMEX (ScanMail for Microsoft Exchange) 10 SP2 but it affects other versions as well. While surfing the SMEX web administrative interface using a web proxy, I have noticed something in the HTTP request - the session token itself and its format, a number. After observing a significant number of logins, the session token was always represented with an number composed of minimum 4 digits and maximum 5 digits, as shown in the screen shot below:   Although the observed session tokens were never generated sequentially, the lack of a cryptographically strong PRNG for the session identifier, allows a malicious user to trivially guess the token. This attack can be easily automated.

Alcatel Lucent Omnivista or: How I learned GIOP and gained Unauthenticated Remote Code Execution (CVE-2016-9796)

It is time for another advisory or better a blog post about Alcatel Lucent Omnivista  and its vulnerabilities. Omnivista is a central management network tool and it is typically used in medium/large organisation with a complex VoIP/SIP infrastructure. Interestingly enough, this software belongs to the niche of "undownloadable" software and it requires a license to work as well. My "luck" came during an engagement where it was already installed and this post documents one of the many 0days discovered during such audit. The reasons why I wanted to dedicate a single blog post on this vulnerability are several. First, remote code execution (RCE) is always a sweet bug to show. Second, I strongly believe that documenting vulnerabilities in applications using old protocols and standards, respectively GIOP and CORBA, can be beneficial for the infosec community, since no many examples of vulnerabilities in such applications are available or published on the Interne

Microsoft .NET MVC ReDoS (Denial of Service) Vulnerability - CVE-2015-2526 (MS15-101)

Microsoft released a security bulletin ( MS15-101 ) describing a .NET MVC Denial of Service vulnerability ( CVE-2015-2526 ) that I reported back in April. This blog post analyses the vulnerability in details, starting from the theory and then providing a PoC exploit against a MVC web application developed with Visual Studio 2013. For those of you who want to see the bug, you can directly skip to the last part of this post or watch the video directly... ;-) A bit of theory The .NET framework (4.5 tested version) uses backtracking regular expression matcher when performing a match against an expression. Backtracking is based on the NFA (non-deterministic finite automata) algorithm engine which is designed to validate all input states. By providing an “evil” regex expression – an expression for which the engine can be forced to calculate an exponential number of states - it is possible to force the engine to calculate an exponential number of states, leading to a condition defined su