Anthology 08Layer 713 CapturesFrameAssembly v3.2.2
Raw .mdllms-full.txt

PostgreSQL, MySQL, Redis, Memcached, MQTT & AMQP Captures

East-west microservice data-tier segmentation and IoT message-bus traces: postgres v3 Wire queries, mysql greetings and SQL commands, redis RESP arrays, memcached TCP/UDP, mqtt, and amqp.

Key Takeaways
  • postgres, mysql, and redis build authentic binary/RESP wire messages on TCP 5432, 3306, and 6379 for zero-trust east-west ACL testing.
  • memcached is one of the 9 dual-transport protocols, supporting default UDP 11211 (8-byte request ID header) or transport tcp.
  • mqtt (TCP 1883) and amqp (TCP 5672) encode variable-length broker frames for industrial and cloud pub/sub telemetry validation.
Companion walkthrough:Poke Firewalls, Suricata & OT
Example 08.019 Ethernet framesFilter: pgsql

Dual-Stack IPv4 + IPv6 PostgreSQL Read-Replica Health Flow

Runs an identical PostgreSQL v3 startup, authentication, and SQL readiness probe across IPv4 and IPv6 database subnets via flow(app, db).

Wire details: Encodes big-endian PostgreSQL StartupMessage (196608 = v3.0), AuthenticationOk, Query ("Q"), CommandComplete ("C"), and ReadyForQuery ("Z").

postgres_dual_stack_replica.frasm21 lines
Open in Playground
host api_v4 { ip 10.50.1.10 }
host pg_v4 { ip 10.50.2.54 }
host api_v6 { ip 2001:db8:50:1::10 }
host pg_v6 { ip 2001:db8:50:2::54 }
flow pg_replica_check(app, db) {
app -> db tcp syn srcport 54320 dstport 5432 win 65535 mss 1440 wait 1ms
app <- db tcp syn ack win 65535 mss 1440 wait 1ms
app -> db tcp ack wait 1ms
app -> db postgres startup user "health_ro" db "analytics" wait 1ms
app <- db postgres authok wait 1ms
app <- db postgres readyforquery wait 1ms
app -> db postgres query sql "SELECT pg_is_in_recovery();" wait 2ms
app <- db postgres commandcomplete wait 1ms
app <- db postgres readyforquery
}
compile {
pg_replica_check(api_v4, pg_v4)
pg_replica_check(api_v6, pg_v6)
}
Terminal Commands (FrameAssembly CLI v3.2.2)
frameassembly postgres_dual_stack_replica.frasm
Example 08.0211 Ethernet framesFilter: mqtt

MQTT v3.1.1 Broker Connect, Topic Subscribe & QoS 1 Publish / PubAck

Models an edge gateway connecting to an internal MQTT broker on TCP 1883, subscribing to command topics, and publishing QoS 1 sensor telemetry.

Wire details: Encodes variable-byte MQTT Remaining Length headers across CONNECT, CONNACK, SUBSCRIBE, SUBACK, PUBLISH, PUBACK, and PINGREQ/PINGRESP.

mqtt_qos1_sensor_bus.frasm16 lines
Open in Playground
host edge_gw { ip 10.75.10.22 }
host mqtt_broker { ip 10.75.0.18 }
compile {
edge_gw -> mqtt_broker tcp syn srcport 51883 dstport 1883 win 65535 mss 1460 wait 1ms
edge_gw <- mqtt_broker tcp syn ack win 65535 mss 1460 wait 1ms
edge_gw -> mqtt_broker tcp ack wait 1ms
edge_gw -> mqtt_broker mqtt connect clientid "gw-line04" wait 2ms
edge_gw <- mqtt_broker mqtt connack returncode 0 wait 2ms
edge_gw -> mqtt_broker mqtt subscribe pktid 10 topic "plant/line04/cmd/#" qos 1 wait 2ms
edge_gw <- mqtt_broker mqtt suback pktid 10 qos 1 wait 3ms
edge_gw -> mqtt_broker mqtt publish pktid 11 topic "plant/line04/temp" qos 1 payload "{\"c\":64.5}" wait 2ms
edge_gw <- mqtt_broker mqtt puback pktid 11 wait 10ms
edge_gw -> mqtt_broker mqtt pingreq wait 1ms
edge_gw <- mqtt_broker mqtt pingresp
}
Terminal Commands (FrameAssembly CLI v3.2.2)
frameassembly mqtt_qos1_sensor_bus.frasm
Protocol references:tcp(TCP & RFC 7323)mqtt(MQTT)
Example 08.038 Ethernet framesFilter: vlan.id == 50 && tcp.port == 5432

DMZ Web App to Internal PostgreSQL (TCP 5432) Segmentation Check

Tests a narrow East-West firewall rule allowing a DMZ web server to authenticate and run a health query against an internal PostgreSQL database on TCP port 5432.

Wire details: Feed this .pcap into Suricata or firewall packet-tracer tools to confirm deep-packet inspection recognizes valid PostgreSQL wire framing over VLAN 50.

fw_dmz_postgres_5432.frasm17 lines
Open in Playground
// DMZ application node and internal database host
host dmz_app { ip 172.16.50.20 }
host prod_db { ip 10.50.20.40 }
compile {
// 1. Complete 3-way TCP handshake on PostgreSQL port 5432 (VLAN 50)
dmz_app -> prod_db vlan 50 tcp syn srcport 52400 dstport 5432 win 65535 mss 1460 wait 1ms
dmz_app <- prod_db vlan 50 tcp syn ack win 65535 mss 1460 wait 1ms
dmz_app -> prod_db vlan 50 tcp ack wait 1ms
// 2. PostgreSQL v3.0 startup, auth OK, and lightweight SQL check
dmz_app -> prod_db vlan 50 postgres startup user "app_svc" db "orders" wait 1ms
dmz_app <- prod_db vlan 50 postgres authok wait 1ms
dmz_app -> prod_db vlan 50 postgres query sql "SELECT 1;" wait 2ms
dmz_app <- prod_db vlan 50 postgres commandcomplete wait 1ms
dmz_app <- prod_db vlan 50 postgres readyforquery
}
Terminal Commands (FrameAssembly CLI v3.2.2)
frameassembly fw_dmz_postgres_5432.frasm
Example 08.047 Ethernet framesFilter: pgsql

Minimal Two-Block PostgreSQL (postgres) Quickstart

Smallest zero-boilerplate host + compile capture for PostgreSQL Frontend/Backend Wire Protocol v3.0 (TCP 5432, Dual-Stack IPv4/IPv6).

Wire details: Defaults to TCP destination port 5432 (psh ack) and writes Protocol Version 3.0 (0x00030000) inside startup frames.

postgres_quickstart.frasm12 lines
Open in Playground
host app_pod { ip 10.50.10.12 }
host pg_db { ip 10.50.20.54 }
compile {
app_pod -> pg_db tcp syn srcport 55432 dstport 5432 wait 1ms
app_pod <- pg_db tcp syn ack wait 1ms
app_pod -> pg_db tcp ack wait 1ms
app_pod -> pg_db postgres startup user "app_ro" db "inventory" wait 2ms
app_pod <- pg_db postgres authok wait 1ms
app_pod <- pg_db postgres readyforquery wait 2ms
app_pod -> pg_db postgres query sql "SELECT sku, qty FROM stock WHERE qty < 10;"
}
Terminal Commands (FrameAssembly CLI v3.2.2)
frameassembly postgres_quickstart.frasm
Protocol references:postgres(PostgreSQL)
Example 08.056 Ethernet framesFilter: mysql

Minimal Two-Block MySQL / MariaDB (mysql) Quickstart

Smallest zero-boilerplate host + compile capture for MySQL & MariaDB Wire Protocol v10 (TCP 3306, Dual-Stack IPv4/IPv6).

Wire details: Defaults to TCP destination port 3306 (psh ack) and computes the 3-byte little-endian MySQL packet length automatically.

mysql_quickstart.frasm11 lines
Open in Playground
host app_srv { ip 10.50.1.20 }
host mysql_db { ip 10.50.2.33 }
compile {
app_srv -> mysql_db tcp syn srcport 53306 dstport 3306 wait 1ms
app_srv <- mysql_db tcp syn ack wait 1ms
app_srv -> mysql_db tcp ack wait 1ms
app_srv <- mysql_db mysql greeting serverversion "8.0.36" wait 2ms
app_srv -> mysql_db mysql login user "app_rw" db "orders" wait 2ms
app_srv <- mysql_db mysql ok
}
Terminal Commands (FrameAssembly CLI v3.2.2)
frameassembly mysql_quickstart.frasm
Protocol references:mysql(MySQL / MariaDB)
Example 08.065 Ethernet framesFilter: redis || tcp.port == 6379

Minimal Two-Block Redis (RESP) (redis) Quickstart

Smallest zero-boilerplate host + compile capture for Redis Serialization Protocol Cache & Broker (TCP 6379, Dual-Stack IPv4/IPv6).

Wire details: Defaults to TCP destination port 6379 (psh ack) and formats exact *N\r\n$<len>\r\n... RESP multibulk wire arrays.

redis_quickstart.frasm10 lines
Open in Playground
host api_pod { ip 10.44.1.12 }
host redis_primary { ip 10.44.2.10 }
compile {
api_pod -> redis_primary tcp syn srcport 51637 dstport 6379 wait 1ms
api_pod <- redis_primary tcp syn ack wait 1ms
api_pod -> redis_primary tcp ack wait 1ms
api_pod -> redis_primary redis set key "session:4821" value "active" wait 1ms
api_pod <- redis_primary redis replytype "ok" value "OK"
}
Terminal Commands (FrameAssembly CLI v3.2.2)
frameassembly redis_quickstart.frasm
Protocol references:redis(Redis (RESP))
Example 08.076 Ethernet framesFilter: mqtt

Minimal Two-Block MQTT (mqtt) Quickstart

Smallest zero-boilerplate host + compile capture for Message Queuing Telemetry Transport (IoT & IIoT) (TCP 1883, Dual-Stack IPv4/IPv6).

Wire details: Defaults to TCP destination port 1883 (psh ack) and encodes the multi-byte variable-length Remaining Length field per OASIS MQTT §2.2.3.

mqtt_quickstart.frasm11 lines
Open in Playground
host edge_gw { ip 10.60.10.25 }
host broker { ip 10.60.10.10 }
compile {
edge_gw -> broker tcp syn srcport 51883 dstport 1883 wait 1ms
edge_gw <- broker tcp syn ack wait 1ms
edge_gw -> broker tcp ack wait 1ms
edge_gw -> broker mqtt connect clientid "gw-rack04" keepalive 60 wait 2ms
edge_gw <- broker mqtt connack returncode 0 wait 2ms
edge_gw -> broker mqtt publish topic "dc1/rack04/kw" qos 0 retain payload "4.85"
}
Terminal Commands (FrameAssembly CLI v3.2.2)
frameassembly mqtt_quickstart.frasm
Protocol references:mqtt(MQTT)
Example 08.0811 Ethernet framesFilter: pgsql

PostgreSQL (postgres): Full PostgreSQL v3.0 Startup, SQL Query Lifecycle & ErrorResponse

Completes a TCP 5432 handshake, authenticates via startup -> authok -> readyforquery, runs an audit query (commandcomplete + readyforquery), and triggers an errorresponse on a restricted table.

Wire details: Defaults to TCP destination port 5432 (psh ack) and writes Protocol Version 3.0 (0x00030000) inside startup frames. Computes the 32-bit big-endian self-inclusive length (4 + body_bytes) on every 'R', 'Q', 'C', 'Z', and 'E' message.

postgres_session_audit.frasm19 lines
Open in Playground
host api_svc { ip 172.16.54.15 }
host pg_pri { ip 172.16.54.100 }
compile {
api_svc -> pg_pri tcp syn srcport 51432 dstport 5432 win 65535 mss 1460 wait 1ms
api_svc <- pg_pri tcp syn ack win 65535 mss 1460 wait 1ms
api_svc -> pg_pri tcp ack wait 1ms
// 1. Client-first StartupMessage -> AuthenticationOk + ReadyForQuery ('I')
api_svc -> pg_pri postgres startup user "reporting_ro" db "analytics" wait 2ms
api_svc <- pg_pri postgres authok wait 1ms
api_svc <- pg_pri postgres readyforquery wait 2ms
// 2. Authorized SELECT query -> CommandComplete + ReadyForQuery
api_svc -> pg_pri postgres query sql "SELECT count(*) FROM daily_events;" wait 3ms
api_svc <- pg_pri postgres commandcomplete wait 1ms
api_svc <- pg_pri postgres readyforquery wait 4ms
// 3. Unauthorized write attempt -> ErrorResponse ('E')
api_svc -> pg_pri postgres query sql "DROP TABLE audit_trail;" wait 2ms
api_svc <- pg_pri postgres errorresponse
}
Terminal Commands (FrameAssembly CLI v3.2.2)
frameassembly show postgres_session_audit.frasm
Example 08.0914 Ethernet framesFilter: mysql

MySQL / MariaDB (mysql): Blocked root Login (errcode 1045) + Authorized Application SQL Session

Shows a rejected root login returning MySQL Error 1045, followed by an authorized app_ro connection running a SELECT query.

Wire details: Defaults to TCP destination port 3306 (psh ack) and computes the 3-byte little-endian MySQL packet length automatically. Encodes NUL-terminated server version, thread ID, auth-plugin-data salt, and capability flags inside greeting so Wireshark recognizes the session as MySQL.

mysql_dam_audit.frasm21 lines
Open in Playground
host web_node { ip 172.16.50.15 }
host db_main { ip 172.16.60.10 }
compile {
// 1. Unauthorized root login attempt -> MySQL Error 1045
web_node -> db_main tcp syn srcport 54306 dstport 3306 win 65535 mss 1460 wait 1ms
web_node <- db_main tcp syn ack win 65535 mss 1460 wait 1ms
web_node -> db_main tcp ack wait 1ms
web_node <- db_main mysql greeting serverversion "8.0.37-commercial" wait 2ms
web_node -> db_main mysql login user "root" db "mysql" wait 2ms
web_node <- db_main mysql err errcode 1045 wait 5ms
// 2. Authorized query on a second connection
web_node -> db_main tcp syn srcport 54307 dstport 3306 win 65535 mss 1460 wait 1ms
web_node <- db_main tcp syn ack win 65535 mss 1460 wait 1ms
web_node -> db_main tcp ack wait 1ms
web_node <- db_main mysql greeting serverversion "8.0.37-commercial" wait 1ms
web_node -> db_main mysql login user "app_ro" db "billing" wait 1ms
web_node <- db_main mysql ok wait 2ms
web_node -> db_main mysql query sql "SELECT invoice_id, total_cents FROM invoices WHERE paid = 0 LIMIT 25" wait 3ms
web_node <- db_main mysql ok
}
Terminal Commands (FrameAssembly CLI v3.2.2)
frameassembly show mysql_dam_audit.frasm
Example 08.1011 Ethernet framesFilter: redis || tcp.port == 6379

Redis (RESP) (redis): Blocked Unauthenticated CONFIG Probe (-NOAUTH) + Authenticated Cache Read/Write

Tests an unauthenticated command rejected with -NOAUTH Authentication required., followed by AUTH, SET, and bulk GET.

Wire details: Defaults to TCP destination port 6379 (psh ack) and formats exact *N\r\n$<len>\r\n... RESP multibulk wire arrays. Emits +OK\r\n (replytype "ok"), -ERR ...\r\n (replytype "err"), :<num>\r\n (replytype "integer"), or $<len>\r\n<value>\r\n (replytype "bulk") on server responses.

redis_security_audit.frasm18 lines
Open in Playground
host app_worker { ip 172.16.44.20 }
host cache_node { ip 172.16.44.63 }
compile {
app_worker -> cache_node tcp syn srcport 52637 dstport 6379 win 65535 mss 1460 wait 1ms
app_worker <- cache_node tcp syn ack win 65535 mss 1460 wait 1ms
app_worker -> cache_node tcp ack wait 1ms
// 1. Unauthenticated probe rejected with RESP error (-)
app_worker -> cache_node redis cmd "INFO" wait 1ms
app_worker <- cache_node redis replytype "err" value "NOAUTH Authentication required." wait 3ms
// 2. Authenticate + SET + GET
app_worker -> cache_node redis cmd "AUTH" args "LabCacheToken2026" wait 1ms
app_worker <- cache_node redis replytype "ok" value "OK" wait 1ms
app_worker -> cache_node redis set key "ratelimit:198.51.100.9" value "42" wait 1ms
app_worker <- cache_node redis replytype "ok" value "OK" wait 1ms
app_worker -> cache_node redis get key "ratelimit:198.51.100.9" wait 1ms
app_worker <- cache_node redis replytype "bulk" value "42"
}
Terminal Commands (FrameAssembly CLI v3.2.2)
frameassembly show redis_security_audit.frasm
Example 08.116 Ethernet framesFilter: memcache

Memcached (memcached): UDP 11211 stats Amplification Audit + TCP ASCII & Binary Cache Operations

Tests a UDP 11211 stats probe, then opens a TCP 11211 session exercising both ASCII set/get and Binary (opcode 0x00) get.

Wire details: Prepends the mandatory 8-byte Memcached UDP frame header (Request ID, Seq 0, Total Datagrams 1, Reserved 0) automatically on UDP 11211, and omits it cleanly when transport tcp is set. Formats exact <byte_len>\r\n<value>\r\n blocks on ASCII set commands.

memcached_udp_and_tcp.frasm13 lines
Open in Playground
host auditor { ip 172.16.45.10 }
host memcache { ip 172.16.45.112 }
compile {
// 1. UDP 11211 amplification audit probe (with 8-byte UDP header)
auditor -> memcache memcached cmd "stats" wait 4ms
// 2. Authorized internal TCP 11211 session (ASCII + Binary)
auditor -> memcache tcp syn srcport 53211 dstport 11211 win 65535 mss 1460 wait 1ms
auditor <- memcache tcp syn ack win 65535 mss 1460 wait 1ms
auditor -> memcache tcp ack wait 1ms
auditor -> memcache memcached set key "cfg:feature_x" value "enabled" flags 0 exptime 600 transport tcp wait 2ms
auditor -> memcache memcached get key "cfg:feature_x" opcode 0x00 opaque 0x99 transport tcp
}
Terminal Commands (FrameAssembly CLI v3.2.2)
frameassembly show memcached_udp_and_tcp.frasm
Example 08.1212 Ethernet framesFilter: mqtt

MQTT (mqtt): IIoT Gateway Connect, Wildcard Topic Subscribe, QoS 1 Publish & Keepalive Ping

Connects an industrial gateway to TCP 1883, subscribes to control commands, publishes a qos 1 retained sensor reading acknowledged via puback, and exchanges pingreq/pingresp.

Wire details: Defaults to TCP destination port 1883 (psh ack) and encodes the multi-byte variable-length Remaining Length field per OASIS MQTT §2.2.3. Encodes the "MQTT" Protocol Level 4 header inside connect, and includes the 2-byte Packet Identifier (pktid) automatically on qos 1 / qos 2 publish, puback, subscribe, and suback packets.

mqtt_iiot_telemetry.frasm20 lines
Open in Playground
host plc_gw { ip 192.168.80.21 }
host mqtt_broker { ip 192.168.80.10 }
compile {
plc_gw -> mqtt_broker tcp syn srcport 52883 dstport 1883 win 65535 mss 1460 wait 1ms
plc_gw <- mqtt_broker tcp syn ack win 65535 mss 1460 wait 1ms
plc_gw -> mqtt_broker tcp ack wait 1ms
plc_gw -> mqtt_broker mqtt connect clientid "line2-plc-gw" keepalive 30 wait 2ms
plc_gw <- mqtt_broker mqtt connack returncode 0 wait 2ms
// 1. Subscribe to actuator commands (pktid 1)
plc_gw -> mqtt_broker mqtt subscribe pktid 1 topic "plant1/line2/cmd" qos 1 wait 2ms
plc_gw <- mqtt_broker mqtt suback pktid 1 wait 3ms
// 2. Publish QoS 1 retained telemetry (pktid 2 -> puback)
plc_gw -> mqtt_broker mqtt publish topic "plant1/line2/pressure_bar" qos 1 retain pktid 2 payload "{\"bar\":6.42}" wait 2ms
plc_gw <- mqtt_broker mqtt puback pktid 2 wait 10ms
// 3. Keepalive heartbeat + clean disconnect
plc_gw -> mqtt_broker mqtt pingreq wait 1ms
plc_gw <- mqtt_broker mqtt pingresp wait 2ms
plc_gw -> mqtt_broker mqtt disconnect
}
Terminal Commands (FrameAssembly CLI v3.2.2)
frameassembly show mqtt_iiot_telemetry.frasm
Protocol references:mqtt(MQTT)tcp(TCP & RFC 7323)
Example 08.139 Ethernet framesFilter: amqp

AMQP 0-9-1 (amqp): Full RabbitMQ Connection Startup, Channel Open, Publish, Deliver & Heartbeat

Walks through TCP 5672 connection startup, opening Channel 1, publishing an audit event to "sec.events", delivering to a worker, and sending a Channel 0 heartbeat.

Wire details: Defaults to TCP destination port 5672 (psh ack) and appends the mandatory 0xce frame-end octet to every AMQP 0-9-1 frame. Emits the exact 8-byte AMQP\x00\x00\x09\x01 connection header on protocolheader so Wireshark locks onto the AMQP dissector.

amqp_rabbitmq_flow.frasm14 lines
Open in Playground
host auth_svc { ip 172.16.65.10 }
host mq_node { ip 172.16.65.56 }
compile {
auth_svc -> mq_node tcp syn srcport 51672 dstport 5672 win 65535 mss 1460 wait 1ms
auth_svc <- mq_node tcp syn ack win 65535 mss 1460 wait 1ms
auth_svc -> mq_node tcp ack wait 1ms
auth_svc -> mq_node amqp protocolheader wait 1ms
auth_svc <- mq_node amqp connectionstart channel 0 wait 2ms
auth_svc -> mq_node amqp channelopen channel 1 wait 2ms
auth_svc -> mq_node amqp basicpublish channel 1 exchange "sec.events" routingkey "login.mfa" payload "{\"user\":\"netadmin\"}" wait 3ms
auth_svc <- mq_node amqp basicdeliver channel 1 exchange "sec.events" routingkey "login.mfa" payload "{\"user\":\"netadmin\"}" wait 10ms
auth_svc <- mq_node amqp heartbeat channel 0
}
Terminal Commands (FrameAssembly CLI v3.2.2)
frameassembly show amqp_rabbitmq_flow.frasm