Smart Grid and AMI Pentesting: Red Team Tactics for the Power Sector
AMI Architecture and Key Protocols
AMI replaces electromechanical meters with smart meters communicating via DLMS/COSEM, IEC 61850, and IEEE 2030.5. NEPRA is driving AMI adoption across Pakistani cities, expanding the attack surface for red teams.
Attack Surface in Pakistan's Smart Grid
- Firmware extraction via insecure UART/JTAG, exposing keys.
- DLMS/COSEM replay to manipulate billing.
- IEC 61850 GOOSE/SMV injection causing protection‑relay misoperations.
- USSD‑based remote disconnect abusing back‑office APIs (linked to OLX/Daraz scams).
- Man‑in‑the‑middle between meters and MDM, intercepting telemetry.
- Consumer data may be linked to NADRA CNIC, requiring careful handling.
Lab: Firmware Extraction and Traffic Analysis
- Identify UART pins with a multimeter/logic analyzer.
- Connect FTDI and dump firmware using
flashrom/openocd. - Analyze firmware with
binwalkto find keys/default passwords. - Capture DLMS traffic in Wireshark (
dlmsfilter) to seegetRequest/setRequest. - Replay a billing‑reset command in a sandbox to confirm exploitability.
Exploiting DLMS/COSEM and IEC 61850
- Use python‑dlms to craft
setRequestframes bypassing checksum validation. - Scapy‑IEC61850 can inject malicious GOOSE messages to test relay behavior.
- Map findings to MITRE ATT&CK T0841 (Network Traffic Execution).
Detecting and Mitigating AMI Attacks
- Enforce mutual authentication for DLMS/COSEM with X.509 certificates.
- Segment AMI head‑end from corporate networks.
- Align with PTA and NCCIA 1799 for incident reporting; remediation checklists are at pisa.maahir.io/red‑team/ami‑security.
Do / Don't
- Do obtain written scope from the utility’s NOC before testing.
- Don't attempt real customer disconnects or manipulate live protection gear.
