RFC Gateway Unauthenticated OS Command Execution (10KBLAZE / SAPXPG)
10KBLAZE (OPCDE 2019) is the name given to a class of attacks against an unprotected SAP RFC Gateway port (33XX on an application-server instance, 48XX/33XX on a standalone SAProuter-fronted gateway). It is not a CVE - it exploits the absence or misconfiguration of the gateway’s access-control files, secinfo and reginfo (SAP Notes 1408081, 1421005, 821875). An attacker with only network reachability to the gateway port sends raw SAP NI-framed packets to register a STARTED_PRG conversation with the kernel binary sapxpg, then instructs it to run an arbitrary OS command - with the privileges of <sid>adm, the same account that owns every other SAP kernel process.
The four-packet flow: P1 GW_NORMAL_CLIENT registers a CPI-C client session; P2 F_SAP_INIT opens a STARTED_PRG conversation targeting the sapxpg TP; P3 F_SAP_SEND/SAPXPG_START_XPG_LONG executes the OS command; P4 F_SAP_SEND/SAPXPG_END_XPG retrieves stdout/stderr. If secinfo is missing, empty, or over-permissive (gw/acl_mode not enforced, or a catch-all P TP=* line), the gateway accepts the registration and the command executes. On a correctly hardened gateway (secinfo/reginfo populated, kernel ≥ 745 default), the gateway silently drops P2 - a reliable negative signal distinguishing a hardened target from a transient network issue.
NoteThis is a configuration weakness, not a patchable vulnerability - SAP’s guidance (Note 1408081) predates the 2019 public disclosure by years and is opt-in hardening the customer must apply.
Any network-reachable attacker who can register a STARTED_PRG conversation with sapxpg gains arbitrary OS command execution as <sid>adm with no SAP credential of any kind - full compromise of confidentiality, integrity, and availability of the host and every downstream system it can reach. The follow-on direct-database SQL technique (below) converts this into a persistent, SAP_ALL-equivalent SAP user written directly into the user-master tables, bypassing the ABAP authorization layer entirely.
- SAPMAP
modules/exploitation/sap_gw_xpg_standalone.py- stdlib-only re-implementation of the full P1–P4 wire protocol, with ABAP/Java-gateway and kernel-754-vs-793+ compatibility handling and a built-in hardening diagnostic (F_SAP_INIT timeout = likely protected). - Manual equivalent (historical): pysap
sap_gw_xpg.py/sap_gw_xpg2.py(Python 2, ABAP gateways only). - Manual equivalent: Metasploit
sap_gw_rfc_directand other public 10KBLAZE scripts. - Direct-DB SQL user creation follow-on - once OS command execution is available,
sap_db_sql_writers.py(+ SQL templates insapmap_config.py) drives the samesapxpgprimitive to invoke the target’s own DB CLI (sqlplus,sqlcmd,hdbsql,sqlcli,db2) and write a pre-computed, valid SAP password hash directly intoUSR02/UST04/USR04/USRBF2- creating a service user (USTYP=S) withSAP_ALL-equivalent authorizations, entirely underneath the ABAP kernel and its authorization checks (S_USER_GRP,S_USER_AUT,BAPI_USER_CREATE1). Delivery is per-DB/OS (Oracle/MSSQL on Windows viacmd.exe echo-to-file + CLI; HANA/MaxDB on Linux via a two-steppython3 -cwrite + CLI-i/-Iexecute), driven by SAPXPG’s tight field-length limits (EXTPROG≤128 bytes,PARAMS≤255 bytes). - Manual equivalent (DB write): direct OS/DB-CLI access to the database host, or the same
sap_gw_xpg_standalone.py-class primitive driven by hand againstsqlplus/hdbsql/sqlcli. - Reconnaissance prerequisite: unauthenticated
RFC_SYSTEM_INFO/gateway-monitor probing to obtain target IP, SID, hostname, instance number, and kernel version. - Configuration check: read the running values of
gw/acl_mode,gw/sim_mode,gw/reg_no_conn_info,gw/rem_start, andSAPXPG_SEC_CHECK(viaRZ11/RSPFPAR, or remotely viaPFL_GET_SINGLE_PARAMETER).gw/acl_mode = 0(no ACL check) orgw/sim_mode = 1(log-only, never deny) means the gateway is effectively open even whensecinfo/reginfofiles exist; agw/reg_no_conn_infobelow255leaves known ACL-bypass paths live. Read the running value, not just the profile - these are dynamic parameters (see Profile Parameter Drift). - A single OS-command foothold obtained this way converts directly into an interactive
SAP*super-user SAP GUI session - see Hardcoded and Virtual Super-User SAP*.
- Implement
secinfo/reginfoper SAP Note 1408081’s starting configuration (internal,localkeyword, kernel ≥ 720 / SAP_BASIS ≥ 700 with the referenced support packages); setgw/acl_mode=1. - Store
secinfo/reginfoin the global path ($(DIR_GLOBAL)/secinfo) so it’s consistent across every application-server instance. - Set
gw/reg_no_conn_info = 255(SAP Note 1444282): this parameter is a bitmask that activates the individualsecinfo/reginfoACL-bypass fixes, and a default of1leaves most of them off - meaning a syntactically valid ACL can still be bypassed until the bitmask is complete. - Set
gw/sim_mode = 0. Simulation mode (1) logs ACL violations but never rejects them, so a gateway left in simulation has ACLs that appear configured yet enforce nothing. - Order the
secinfo/reginfoentries as specific permits followed by a terminal deny (Plines thenD *): evaluation is first-match-wins, so a permissiveP TP=* HOST=* USER=*above the deny opens everything. - Do not rely on
gw/rem_start = DISABLEDon its own. When the gateway is co-located with the ABAP server (the normal on-premise layout), a program started via the local-start path can execute regardless ofrem_start; pair the setting with a restrictivesecinfoand ensure nosapxpgprogram is registered. Also setSAPXPG_SEC_CHECKsosapxpgperforms its own security check. - Harden the companion message server per SAP Notes 1421005 / 821875 (
rdisp/msserv_internal,ms/acl_info) - closes the related fake-application-server registration path 10KBLAZE variants also use (see Message Server / Gateway Trust Injection). - Restrict
SM49/SM69and theS_LOG_COM/S_RZL_ADMauthorization objects to users who genuinely need external OS-command capability. - Ensure the DB CLI’s OS-trust model (
sqlplus / as sysdba,hdbsql -U DEFAULT) is independently gated by restricting who can execute as<sid>adm. - Network segmentation: RFC Gateway ports (
33XX,48XX) should never be reachable from outside the trusted SAP network segment.
- Gateway logging (
gw/logging) - logs everySTARTED_PRG/registered-server start attempt including source IP and TP name; alert on anysapxpgstart from a non-admin host. - Transaction SMGW - review active connections and the loaded
secinfo/reginfoACLs for unexpected entries or an empty/missing file. - SM21/
dev_rdsystem log and gateway trace files forSTARTED_PRG/sapxpgentries correlated with unfamiliar source IPs. - OS-level process monitoring:
sqlplus/hdbsql/sqlcli/sqlcmd/db2spawned as a child ofsapxpg/disp+workrather than an interactive admin shell or a scheduled DBA job. - Database-side:
USR02/UST04/USR04/USRBF2INSERT/UPDATEstatements executed via a CLI connection under<sid>adm’s OS-trusted identity, outside the normal ABAP user-management code path - a strong indicator, since the ABAP layer never sees the write and no Security Audit Log user-creation event is generated. - Network-level: any inbound connection to
33XX/48XXfrom outside the trusted admin/application-server network segment is itself worth alerting on.
- SAP Note 1408081 - Basic settings for reg_info and sec_info
- SAP Note 1421005 - Secure configuration of the message server
- SAP Note 821875 - Security settings in the message server
- SAP Note 1444282 - gw/reg_no_conn_info settings (ACL-bypass fix bitmask)
- Profile Parameter Drift & Runtime Config Tampering
- Message Server ACL
