SAP Afaria Stored XSS vulnerability - detailed review

Today we will show how SAP Afaria, an MDM solution from a world-famous software vendor, works and how cybercriminals can attack it in different ways.

In a nutshell, MDM is a set of services that help an administrator of a large company to control the mobile devices (smartphones, tablets, phablets and so on and so forth) of employees, thus establishing the security measures of corporate data stored and processed on those devices. A special application called MDM client is installed on a device and allows administrators to implement settings.

Afaria is used by companies around the world. We have found about 140 Afaria servers available via the Internet.

SAP Afaria worldwide

As you can see from the graph, the largest number of Afaria services is implemented in the US and China.

We would like to describe a very interesting Afaria vulnerability here.

Stored XSS vulnerability

The administrative part of SAP Afaria performs the basic functionality and is available via browser. Web administrative console is where a system administrator can view a list of all connected devices, create new mobile device configurations, download applications, control devices, etc.

So, the XSS vulnerability in the administrative console is likely to be critical for the entire system and for the administrator in particular. A common Afaria user, of course, can’t obtain access to these functionalities. However, an injection of user data is still possible. So, let's examine what will happen if we try to connect a new device to the server without the proper rights (and the user account).

 connection to the server without rights and accounts

That’s what we get: the server, of course, does not allow us to connect this device. However, the list of devices in the administrative console (it is the administrator’s main workspace) shows the information about the device marked as “Not approved”. It means that an attacker can inject some data into the administrative console anonymously. Guess in which field a JS injection is possible. The server does not filter the information before displaying the device IMEI.

It looks like a typical stored XSS. However, the exploit seems interesting because the length of IMEI field is restricted by 15 characters. This restriction doesn’t allow one to inject malicious JavaScript code. But nothing prevents attackers from sending several connection requests specifying only a part of the JS payload and comments.

Let’s assume the attackers want to inject the following JS code:

<script>alert('Hello Afaria! U so secure!');</script>

To do so, they have to send a request to the server with the following values in the IMEI field:

*/a02="lo Af";/*
*/a04=" U so";/*
*/a05=" secu";/*

As you may notice, there are special characters /**/ in every query. They are used to mark comments in JS. This way, unnecessary parts of HTML markup that prevent getting the final result are deleted.

What’s the final result? The web server will build an HTML page in the admin panel in which all the little pieces will be brought together into one JS script to be executed during the administrator’s session. It allows the attacker to gain data from the Afaria admin panel, and thus to control all devices connected to the server.

The screenshot below shows the administrative console’s source code with JS injected into the device IMEI field:

administrative console’s source code with injected JS

Stored XSS vulnerability: Wrap-up

The XSS vulnerability was closed by SAP. Install SAP Note 2152669 to fix this issue.

Please keep in mind that this issue is very critical because it can be remotely exploited without authentication, and there are at least 140 servers available on the Internet. An attacker can get full control over all mobile devices of organization, such as remotely wipe data, lock all smartphones, or even force to upload malicious backdoor which will control user’s data, send critical documents to C&C server, spy on employees, read messages, and record video from cameras.

We will keep posting more blogs on SAP Security here.

Views: 153

Join the Discussion ...

You need to be a member of CISO Platform to join the discussion!

Join CISO Platform



CISO as an enabler

Started by Maheshkumar Vagadiya Jul 30. 0 Replies

Share the instances where you were able to convince the Executive management /board that CISO function is enabler rather then a hindrance.Thanks youMaheshContinue

Has Anyone Evaluated Digital Signature (like Docusign)?

Started by CISO Platform. Last reply by SACHIN BP SHETTY Apr 24. 1 Reply

(question posted on behalf of a CISO member)Has anyone evaluated digital signature (like Docusign), any specific risk/ security areas to be looked into while finalising a vendor? Any and all inputs will be very much appreciated.Continue

What are your strategies for using Zoom in your organization after recent vulnerabilities in news about Zoom platform?

Started by CISO Platform. Last reply by ANAND SHRIMALI May 20. 4 Replies

(question posted on behalf of a CISO member)What are your strategies for using Zoom in your organization after recent vulnerabilities in news about Zoom platform?Related Question: …Continue

[Please Suggest] Corona Virus: Security advisory for work from home

Started by CISO Platform. Last reply by Bhushan Deo Mar 20. 12 Replies

(question posted on behalf of a CISO member)Due to CORONA virus most of the organizations are allowing their employees to work form home.Has any one issued security advisory for work from home ?Continue

Tags: #COVID19

Follow us

Contact Us


Mobile: +91 99002 62585

InfoSec Media Private Limited,First Floor,# 48,Dr DV Gundappa Road, Basavanagudi,Bangalore,Karnataka - 560004

© 2020   Created by CISO Platform.   Powered by

Badges  |  Report an Issue  |  Privacy Policy  |  Terms of Service