Skip to content
RCE Write-up Advanced

CyberGhostVPN - the story of finding MITM, RCE, LPE in the Linux client

The CyberGhostVPN Linux client disabled certificate validation for one API endpoint and built a shell command from the response without sanitisation. An attacker who could redirect that traffic could run commands as root, and a local user could inject commands through their own configuration file to escalate privileges.

mmmds Follow

Published on mmmds.pl

CyberGhost is a company that provides VPN services to individual users. They support many popular platforms, including Windows, macOS, and Linux.

mmmds, on mmmds.pl

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the client disabled TLS certificate validation for one endpoint and passed unsanitised response data into a shell command executed with elevated privileges.

Impact

A man-in-the-middle attacker could redirect the victim's VPN traffic and, by chaining the two issues, execute commands as root; a local unprivileged user with sudo rights limited to the client could also escalate to root.

What the attacker needed

Ability to redirect API traffic (DNS or ARP spoofing); local user can edit ~/.cyberghost/config.ini; sudo configured to allow only the client command

The fix

The issues were fixed in version 1.4.0 (RCE and privilege escalation) and 1.4.1 added certificate pinning; users must manually update because there is no auto-update.

How it was found

  1. Extract the Python bytecode from the ELF binary using pyinstxtractor with the matching Python version.
  2. Decompile the bytecode with decompyle3 to obtain readable Python code.
  3. Search the decompiled code for os.system and subprocess.Popen calls to find command execution helpers.
  4. Identify the Wireguard key-adding function that builds a curl command from token, secret and hostname values.
  5. For local privilege escalation, edit the user's config.ini file to place a payload in the token field, then run the client with sudo.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

A VPN client talks to a server to get connection details. This client did not check that the server was genuine, and it also put those details into a system command without cleaning them. So someone who could pretend to be the server, or a local user who could edit a settings file, could make the computer run their own commands with full administrator rights.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by mmmds

View all

1 more disclosed report, best first.

More from CyberGhost

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.