Cyber Anakins Lightsaber - A Minishell-based backdoor
<?php
require("std2.php");
require("paymentutils.php");
function ErrLog($txt)
{
$f = fopen("_yookassa_error.txt","w");
fprintf($f, $txt);
fclose($f);
die($txt);
}
$postData = file_get_contents('php://input');
if (!preg_match("/\"paid\"\s*\:\s*true/", $response, $g)) ErrLog("Заказ не оплачен!");
if (!preg_match("/\"id\"\s*\:\s*\"([^\"]+)\"/", $postData, $g)) ErrLog("Не найден id платежа от ЮКасса");
$yookassa_id = $g[1];
$mysql = mysqlopen();
$yookassa_id = mysqli_escape_string($mysql, $yookassa_id);
$result = mysqli_query($mysql, "SELECT `id` FROM libOrders WHERE `yookassa_id`='$yookassa_id' LIMIT 1");
if (mysqli_errno($mysql)) ErrLog("mysql error: ".mysqli_error($mysql));
if (!($row = mysqli_fetch_row($result))) ErrlLog("Order $yookassa_id not found!");
$order = $row[0];
mysqli_free_result($result);
mysqli_query($mysql,"UPDATE libOrders SET `payDate`=NOW() WHERE `id`=$order");
if (mysqli_errno($mysql)) ErrLog("mysql error: ".mysqli_error($mysql));
$code = GenOrderProtectionCode($order);
header("Location: basket.php?order=$order&code=$code", 301, true);
?>
May the force be with you, always.