External Template Injection via settings.xml.rels with Embedded Excel Object and Obfuscated PHP Retrieval
1. Executive Summary
During static malware analysis of a malicious Microsoft Word document, we identified a weaponized OpenXML structure leveraging external relationship injection via word/_rels/settings.xml.rels. The document contained a TargetMode="External" relationship referencing a highly obfuscated URL formatted as:
hxxp://<long_hex_string>@<numeric_host>/<payload>.php
Additionally, the document embedded an Excel object under word/embeddings/*.xlsx, likely serving as a lure component to reduce user suspicion.
This technique enables remote payload retrieval while bypassing traditional static detection mechanisms that focus solely on macros or document content. The abuse of the username@host URL format combined with a numeric-only host significantly reduces signature-based detection reliability.
Organizations relying primarily on macro detection or traditional static scanning are particularly exposed. Email-borne threats remain the primary delivery mechanism.
Risk Level: High
Primary Impacted Sectors: Enterprise environments with email-based document workflows
Key Mitigation Focus: External relationship monitoring, behavioral endpoint detection, and email-layer content inspection.
2. Background & Context
External relationship abuse in Office OpenXML documents has been publicly documented in multiple campaigns involving:
- Remote Template Injection
- OLE Object Injection
- Exploitation chains related to Microsoft Word
- Techniques associated with MITRE ATT&CK T1204 abuse
Historically, campaigns exploiting external relationships have overlapped with techniques seen in exploitation chains such as CVE-2017-0199, where malicious documents triggered remote content execution without macros.
What makes this variant notable:
- Use of
settings.xml.relsinstead of commonly inspecteddocument.xml.rels - Obfuscated credential-style URL structure
- Embedded
.xlsxobject to mimic legitimate business content
The increasing restriction of VBA macros in enterprise environments has shifted adversaries toward relationship-based payload staging, making this technique operationally relevant today.
3. Research Scope & Methodology
Sample Source:
- Automated sandbox detonation (Cuckoo-based static and dynamic pipeline)
- Email telemetry ingestion
- Internal threat hunting dataset
Timeframe:
- Recent sample cluster observed within 30-day ingestion window
Scope Limitations:
- Static analysis of OpenXML structure
- No confirmed post-delivery payload execution due to sinkholed infrastructure
Analytical Approach:
- OpenXML archive extraction
- Relationship file inspection
- Regex-based IOC extraction
- Structural anomaly comparison against benign Office baselines
- Behavioral review in sandbox environment
4. Technical Analysis
4.1 Initial Access Vector
The attack vector is a phishing email delivering a Microsoft Word document (.docx). The document does not contain VBA macros.
Instead, it abuses:
word/_rels/settings.xml.rels
to define an external relationship with:
TargetMode="External"
This forces Word to attempt remote retrieval when the document is processed.
4.2 Payload Structure
The malicious relationship contains a URL formatted as:
hxxp://B6B6B6B6B6B6B6B6BB6BB6B6B6B6B6B6B@00005631326225/<random>.php
Key anomalies:
| Component | Observation |
|---|---|
| Username field | 16+ character hex string |
| Host field | Numeric-only domain |
| Path | PHP endpoint |
| Relationship | TargetMode=”External” |
The username@host syntax is leveraged to:
- Obfuscate domain reputation checks
- Confuse URL parsers
- Evade simplistic IOC extraction logic
4.3 Execution Chain
- User opens Word document.
- Word parses
settings.xml.rels. - External relationship is resolved.
- HTTP request initiated to remote PHP endpoint.
- Server responds with staged payload (in observed samples, infrastructure inactive).
No macro execution is required.
4.4 Persistence Mechanism
No persistence mechanism observed within the document itself.
This technique is a stager delivery vector, not a persistence implant.
Persistence would depend on downstream payload.
4.5 Network Communication
Characteristics:
- Plain HTTP
- Numeric-only hostname
- No valid DNS-based domain structure
- Likely short-lived infrastructure
Example (defanged):
hxxp://b6b6b6b6b6b6b6b6bb6bb6b6b6b6b6b6b@00005631326225/payload.php
Such numeric hosts frequently evade domain-based threat intelligence feeds.
4.6 Defense Evasion Techniques
| Technique | Description |
|---|---|
| URL credential obfuscation | username@host format |
| Numeric-only host | Avoids domain reputation triggers |
| Non-macro execution | Bypasses macro-blocking controls |
| Embedded Excel lure | Reduces suspicion |
| Alternate relationship file | Avoids detection tuned for document.xml.rels |
5. Indicators of Compromise (IOCs)
| Type | Indicator (Defanged) | Description |
|---|---|---|
| URL | hxxp://b6b6b6b6b6b6b6b6bb6bb6b6b6b6b6b6b@00005631326225/payload.php | External PHP retrieval |
| File Path | word/_rels/settings.xml.rels | Modified relationship file |
| File Path | word/embeddings/*.xlsx | Embedded Excel lure object |
| XML Attribute | TargetMode=”External” | External relationship indicator |
| Pattern | https?://[A-Fa-f0-9]{16,}@[0-9]{6,}/.*.php | Suspicious URL format |
6. Detection Opportunities
Email Layer Detection
- Flag
.docxfiles containing:TargetMode="External"- External
.phpreferences - Numeric-only hostnames
- Parse all
*.relsfiles, not justdocument.xml.rels - Detect embedded OLE/Excel object + external relationship combination
Endpoint Detection Logic
Monitor:
WINWORD.EXEinitiating outbound HTTP to:- Numeric-only domains
- Hosts without DNS resolution
.phpendpoints
Behavioral detection rule example:
Process: WINWORD.EXE
Network: HTTP outbound
Destination: numeric-only hostname
Network Detection Opportunities
- Block HTTP to numeric-only hosts
- Detect HTTP requests containing
@before host separator - Alert on Office process user-agent anomalies
Behavioral Detection Suggestions
- Word spawning:
mshta.exepowershell.execmd.exe
- Word performing direct HTTP fetch on document open
- Word resolving external relationship immediately after file load
7. MITRE ATT&CK Mapping
| Tactic | Technique | ID |
|---|---|---|
| Initial Access | Phishing Attachment | T1566.001 |
| Execution | User Execution | T1204 |
| Command and Control | Application Layer Protocol | T1071 |
| Defense Evasion | Obfuscated/Compressed Files | T1027 |
| Defense Evasion | Trusted Developer Utilities Proxy Execution | T1218 |
8. Mitigation & Recommendations
Immediate Actions
- Block numeric-only outbound HTTP destinations
- Inspect and quarantine Office documents with external relationships
- Disable automatic update of external links in Office Group Policy
- Enforce outbound web filtering for Office processes
Strategic Improvements
- Implement full OpenXML structural inspection in email security stack
- Deploy behavioral EDR detection for Office outbound communication
- Add relationship-file parsing to sandbox pipelines
- Threat hunt for:
settings.xml.relsexternal references- Embedded
.xlsxwith no business justification
- Incorporate custom YARA or Cuckoo signature detection
9. Conclusion
This research demonstrates continued adversarial adaptation toward macro-less document-based delivery techniques. By abusing settings.xml.rels and leveraging obfuscated credential-style URLs with numeric hosts, attackers bypass many legacy inspection controls.
The presence of embedded Excel objects further increases plausibility while maintaining stealth.
Organizations must move beyond macro detection and implement:
- Structural OpenXML inspection
- Behavioral endpoint detection
- Numeric-host outbound filtering
As macro hardening increases globally, we expect continued growth in relationship-based remote retrieval techniques and alternate XML component abuse within Office documents.
Proactive detection engineering in this area will significantly reduce exposure to modern phishing and staged payload campaigns.