Trustwave's 2024 Retail Report Series Highlights Alarming E-Commerce Threats and Growing Fraud Against Retailers. Learn More

Trustwave's 2024 Retail Report Series Highlights Alarming E-Commerce Threats and Growing Fraud Against Retailers. Learn More

Services
Managed Detection & Response

Eliminate active threats with 24/7 threat detection, investigation, and response.

Co-Managed SOC (SIEM)

Maximize your SIEM investment, stop alert fatigue, and enhance your team with hybrid security operations support.

Advisory & Diagnostics

Advance your cybersecurity program and get expert guidance where you need it most.

Penetration Testing

Test your physical locations and IT infrastructure to shore up weaknesses before exploitation.

Database Security

Prevent unauthorized access and exceed compliance requirements.

Email Security

Stop email threats others miss and secure your organization against the #1 ransomware attack vector.

Digital Forensics & Incident Response

Prepare for the inevitable with 24/7 global breach response in-region and available on-site.

Firewall & Technology Management

Mitigate risk of a cyberattack with 24/7 incident and health monitoring and the latest threat intelligence.

Solutions
BY TOPIC
Microsoft Security
Unlock the full power of Microsoft Security
Offensive Security
Solutions to maximize your security ROI
Rapidly Secure New Environments
Security for rapid response situations
Securing the Cloud
Safely navigate and stay protected
Securing the IoT Landscape
Test, monitor and secure network objects
Why Trustwave
About Us
Awards and Accolades
Trustwave SpiderLabs Team
Trustwave Fusion Security Operations Platform
Trustwave Security Colony
Partners
Technology Alliance Partners
Key alliances who align and support our ecosystem of security offerings
Trustwave PartnerOne Program
Join forces with Trustwave to protect against the most advance cybersecurity threats

Unauthenticated Backdoor Access in Unanet

The default configuration of the Unanet web application has a backdoor that can allow unauthenticated users to login and manipulate the user accounts and the roles they maintain. This vulnerability is due to a code branch that exists within the product that maintains a hardcoded user that is unlisted in the users table of the database. The user was originally identified via a user enumeration vulnerability (see below).

Although the user is unable to login directly, the vulnerable nature of how session cookies function within Unanet (zero entropy and no session timeouts) allows anyone to bypass the need to authenticate with this user.

The construction of a Unanet session cookie is as follows, UserID, username in uppercase, roles concatenated together with '^', static cookie value, and digest. The digest is created similar to the following psuedo code:

username = "csanders".upper()
id="718"
roles = ["unaSourceUser","timesheetUser","expenseUser"]
cookval = "q4Z26w&3@1xya"
m = hashlib.md5(id+"|"+username+"|"+('^'.join(roles))+"|"+cookval)
digest = m.hexdigest()


Another issue is that usernames and ID's were available via a user enumeration. By iterating the 'personkey' value, each username and id would echo into an error page that could be parsed to obtain a list of existing usernames within the system.

Role values were also known as they exist within the 'Roles' tab on 'https://x.host.com/unanet/action/preferences'. The actual value that is used within the cookie is available as the value of each checkbox. We identified 19 roles within our environment. Without any knowledge of the normal roles associated with users (for instance customer and administrator are not typically used together) there are 19! permutations, with intelligence we brought this number down ~5! permutations, well within the range of a simple brute force.

8460_2a55a98c-22a6-4755-a9e1-b54311756f08

Having obtained the userID, usernames, roles, the last remaining piece of data is the special cookie value. This value is referred to as a nonce. However, a nonce by definition is only used once (http://en.wikipedia.org/wiki/Cryptographic_nonce). This is set to a default value that is outlined in http://www.unanet.com/unadocs/unanet92/getting_started/installing_unanet/advanced/cookies_and_md5.htm. The default nonce value can be changed from 'q4Z26w&3@1xya' but this is only a recommendation, not a requirement.

As long as that default value has not been changed, the hidden cookie value can be brute forced offline using the knowledge of all other values. This is true because the algorithm for generating the digest is known and when userid, username, roles, and digest are known it becomes a simple problem of solving for the single missing variable.

However, it became clear that user unanet (id 0) was not handled in the same way. Since this user was identified by the user enumeration but not within our user list, we investigated the code. We found the following within the personfactory.class:

public static Person make(Long personKey, Connection con)
throws SQLException
{
if (personKey == null) {
return null;
}
if (personKey.longValue() == 0L) {
return makeAdmin();
}
public static Person makeAdmin()
{
Person unanet = new Person(Long.valueOf(0L), "UNANET", UNANET");
unanet.setName(new Name("Unanet", (Character)null, "Unanet", ull, unanet.getUsername()));
unanet.setPassword("UNANET");
unanet.setUnanetAdministrator(true);
unanet.setActive(true);
unanet.setPasswordDate(new java.util.Date());
return unanet;


This identified that if the personkey was zero, it would go to the makeadmin section. When this method was called, it generated a new person 'unanet' and assigned that password, 'UNANET'. More interestingly though it then called 'setUnanetAdministrator(true)'. Tracing that method we get:

public void setUnanetAdministrator(boolean unanetAdministrator)
{
if (unanetAdministrator) {
addGroup("__unanetAdministrator__");
} else {
removeGroup("__unanetAdministrator__");
}
}

After uncovering the UserID, Username, and seeing the secret group __unanetAdministrator__, we could now generate our digest. Our cookie then becomes:

'unanetAccess=0%7CUNANET%7C__unanetAdministrator__%7C477c49a990eeabde873313578ce1daeb'

We were able to successfully log in with this user.

This is not some deep, arcane issue. Anyone having access to a Unanet system is capable of generating the same conclusion via a simple code review. Additionally, even if the cookie 'nonce' was changed, any user of the system (or attacker who intercepts a request) is capable of brute forcing the new nonce offline. Currently any system that has not changed their cookie 'nonce' is vulnerable to an unauthenticated attacker being able to login with unanetAdministrator privileges. This includes public facing instances of Unanet. A simple Google search (http://www.google.com/#q=intitle%3Aunanet+Login) returns ~1600 results of such instances.

Exploitation of this vulnerability allows an unauthenticated attacker access to remove users, change roles, and create a new administrator. An attacker can use these privileges to deny availability, comprise integrity, and remove confidentiality.

Steps to Reproduce

  1. Navigate to a Unanet site.
  2. Open up a proxy such as Burp.
  3. Proxy the initial login page through Burp
  4. Add the 'Cookie: unanetAccess=0%7CUNANET%7C__unanetAdministrator__%7C477c49a990eeabde873313578ce1daeb' to the report
  5. Forward the request and you will be logged into the application as Unanet

11314_b2d21de8-f683-4bce-96b0-9113eaa24597


Mitigation

Fixes for this issue were released in Unanet versions 10.0.51, 10.1.43, and 10.2.5.
For more information see the Trustwave advisory: TWSL2017-004

ABOUT TRUSTWAVE

Trustwave is a globally recognized cybersecurity leader that reduces cyber risk and fortifies organizations against disruptive and damaging cyber threats. Our comprehensive offensive and defensive cybersecurity portfolio detects what others cannot, responds with greater speed and effectiveness, optimizes client investment, and improves security resilience. Learn more about us.

Latest Intelligence

Discover how our specialists can tailor a security program to fit the needs of
your organization.

Request a Demo