Loki RAT (Relapse) Directory Traversal / Arbitrary File Deletion

Loki RAT (Relapse) malware suffers from a directory traversal vulnerability that can allow for arbitrary file deletion.


MD5 | 4bef4a286d43bda4977fcfb80e5556af

Discovery / credits: Malvuln - malvuln.com (c) 2022
Original source: https://malvuln.com/advisory/aabb54951546132e70a8e9f02bf8b5ba.txt
Contact: [email protected]
Media: twitter.com/malvuln

Threat: Loki RAT (Relapse)
Vulnerability: Directory Traversal - Arbitrary File Delete
Description: The LokiRAT WebUI panel for "LokiRAT_Relapse.exe" runs on PHP and MySQL and is used control infected hosts through a central server.
The admin webpage "admin.php" takes four parameters pass, command, id and type. Theres a single check to authenticate $_GET['pass'] against a hardcoded clear-text password in settings.php.

The backend "admin.php" code has an upload feature, it uses PHP "unlink" function to delete a file before moving the new one. However, the code does not
use any secure coding practices, sanitize or filter user input for directory traversal characters "/../". This can allow authenticated users, compromised bots or third-party attackers
who can guess the password check, ability to delete any file E.g. ".php", ".htaccess" etc in the root panel outside the "uploads/" dir, causing Loki web panel to become inoperative.

admin.php snippet:

case "upload":
$fullfilename = "uploads/" . $_GET['filename'];
if (file_exists($fullfilename)) unlink ($fullfilename);
move_uploaded_file($_FILES['file']['tmp_name'], $fullfilename);

Family: Loki
Type: WebUI
MD5: aabb54951546132e70a8e9f02bf8b5ba
MD5: 16c33e28c8c9b3ea71249ad94be4bf94 (admin.php)
Vuln ID: MVID-2022-0509
Disclosure: 03/05/2022

Exploit/PoC:
delete "settings.php" file which holds database connection, rendering the backend inoperative.

http://LOKI-RAT-IP/PHP%20Files/admin.php?pass=test&command=webcam&id=1&type=upload&filename=/../settings.php

Disclaimer: The information contained within this advisory is supplied "as-is" with no warranties or guarantees of fitness of use or otherwise. Permission is hereby granted for the redistribution of this advisory, provided that it is not altered except by reformatting it, and that due credit is given. Permission is explicitly given for insertion in vulnerability databases and similar, provided that due credit is given to the author. The author is not responsible for any misuse of the information contained herein and accepts no responsibility for any damage caused by the use or misuse of this information. The author prohibits any malicious use of security related information or exploits by the author or elsewhere. Do not attempt to download Malware samples. The author of this website takes no responsibility for any kind of damages occurring from improper Malware handling or the downloading of ANY Malware mentioned on this website or elsewhere. All content Copyright (c) Malvuln.com (TM).

Related Posts