The Many Paths to Protocol Invocation

Series: Decoding BYOPH (Part 5 of 7) Reading time: 7 minutes Skill level: Intermediate


πŸ“ LinkedIn Post Content

A protocol handler is useless until someone clicks a link. But attackers have many optionsβ€”from Word documents to browser redirects to email links.

Today we explore the full attack surface of protocol invocation.


🎯 What You’ll Learn Today

βœ… Invoke handlers from Office documents (Word, Excel, PowerPoint) βœ… Invoke handlers from PDF files βœ… Invoke handlers from web browsers (HTML, JavaScript) βœ… Understand browser security prompts and their limitations βœ… See the full attack surface from a defender’s perspective


πŸ•ΈοΈ The Invocation Surface

Protocol handlers can be triggered from almost anywhere that handles URLs:

1
2
3
4
5
6
7
8
9
10
11
DOCUMENT-BASED                 WEB-BASED
β”œβ”€β”€ Microsoft Word             β”œβ”€β”€ HTML anchor tags
β”œβ”€β”€ Microsoft Excel            β”œβ”€β”€ JavaScript redirects
β”œβ”€β”€ Microsoft PowerPoint       β”œβ”€β”€ Meta refresh tags
β”œβ”€β”€ PDF readers                └── iframes
β”œβ”€β”€ OneNote
└── LibreOffice                OTHER
                               β”œβ”€β”€ Email clients (Outlook, etc.)
                               β”œβ”€β”€ Chat apps (Teams, Slack)
                               β”œβ”€β”€ Note-taking apps
                               └── Any app that renders URLs

This wide surface is what makes BYOPH so versatile.


πŸ“„ Document-Based Invocation

Microsoft Word:

  1. Open Word β†’ New document
  2. Type text: β€œClick here for the portal”
  3. Select text β†’ Insert β†’ Link
  4. Enter address: myscheme://payload
  5. Save document
  6. When recipient clicks the link β†’ Handler invoked

The link looks completely normal in the document. Users can’t easily see it’s a custom scheme.

PDF Files: β€’ Export from Word: File β†’ Export β†’ Create PDF β€’ The hyperlink survives the conversion β€’ PDF readers will invoke the handler when clicked

PowerPoint: β€’ Add hyperlink to any object (shape, text, image) β€’ Presentation mode: clicking triggers the handler β€’ Great for β€œclick here to continue” scenarios


🌐 Browser-Based Invocation

Method 1: Simple HTML Anchor

1
<a href="myscheme://data">Click here</a>

Method 2: JavaScript Location

1
window.location.href = "myscheme://payload";

Method 3: JavaScript Window.open

1
window.open("myscheme://payload");

Method 4: Meta Refresh (Auto-redirect)

1
<meta http-equiv="refresh" content="0;url=myscheme://auto">

Method 5: Hidden iframe (Sneaky)

1
<iframe src="myscheme://background" style="display:none"></iframe>

🚨 Browser Security Prompts

Modern browsers show a confirmation dialog:

1
2
3
4
5
6
7
8
9
10
11
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Open myscheme://?                  β”‚
β”‚                                     β”‚
β”‚  An external application is         β”‚
β”‚  required to handle this link.      β”‚
β”‚                                     β”‚
β”‚  ☐ Always allow example.com to      β”‚
β”‚    open myscheme:// links           β”‚
β”‚                                     β”‚
β”‚  [Cancel]            [Open]         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

The problem: Users often click β€œOpen” without thinking, especially if: β€’ The link text looks legitimate β€’ They just imported a β€œconfiguration” file β€’ The scheme name sounds trustworthy

The bigger problem: That checkbox. If users check β€œAlways allow,” future invocations bypass the prompt entirely.


πŸ“Š Browser Behavior Comparison

Browser Shows Prompt Remember Choice Auto-invoke After
Chrome Yes Yes (checkbox) If checked
Edge Yes Yes (checkbox) If checked
Firefox Yes Yes (checkbox) If checked
Safari Yes No Never

🎭 Attack Chain: Phishing + BYOPH

Here’s how a real attack might unfold:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
DAY 1: SETUP
β”œβ”€β”€ Attacker sends email with .reg attachment
β”œβ”€β”€ "Please import this VPN configuration"
└── User imports β†’ Handler registered

DAY 2-30: DORMANT
└── Handler sits in registry, waiting

DAY 31: TRIGGER
β”œβ”€β”€ Attacker sends follow-up email
β”œβ”€β”€ Contains link to legitimate-looking page
β”œβ”€β”€ Page has: <a href="vpn-connect://auth">Connect to VPN</a>
β”œβ”€β”€ User clicks β†’ "Open external app?" β†’ User clicks Open
└── Malware executes

Why the delay matters: β€’ Separates suspicious .reg import from execution β€’ User may forget they imported anything β€’ Makes correlation harder for defenders


πŸ›‘οΈ Defense Recommendations

User Training: β€’ Treat .reg files like executablesβ€”they enable code execution β€’ Be suspicious of β€œOpen external application?” prompts β€’ Never check β€œAlways allow” for unknown schemes

Technical Controls: β€’ Block .reg file downloads at web proxy β€’ Monitor for .reg files in email attachments β€’ Alert on new protocol handler registrations β€’ Consider application whitelisting

Browser Hardening: β€’ Some browsers allow enterprise policies for scheme blocking β€’ Consider blocking unknown schemes at the browser level β€’ Audit β€œalways allow” permissions periodically


πŸ§ͺ Lab Exercise

In your isolated VM with a registered test handler:

Exercise 1: Document Invocation

  1. Create a Word document with a link to your test scheme
  2. Save, close, and reopen
  3. Click the linkβ€”observe the behavior
  4. Export to PDF and test again

Exercise 2: Browser Methods Create an HTML file and test each method:

1
2
<a href="labtest://anchor">Anchor Tag</a>
<button onclick="window.location='labtest://js'">JavaScript</button>

Document your findings: Which methods show prompts? Which don’t?


πŸ“Œ Key Takeaways

  1. The attack surface is hugeβ€”any URL-rendering app can invoke handlers
  2. Documents are dangerousβ€”links in Word/PDF look completely normal
  3. Browser prompts are weakβ€”users click through them habitually
  4. β€œAlways allow” is permanentβ€”creates a silent execution path
  5. Time separation between registration and triggering complicates detection

⚠️ SAFETY REMINDER

1
2
3
4
5
6
7
8
Test only with benign handlers!

βœ“ Use the Notepad or logging handler from Part 3
βœ“ Never create handlers with network callbacks
βœ“ Test in isolated VMs only
βœ“ Clean up all test documents afterward

Educational purposes only.

πŸ”œ Coming Next Week

In Part 6, we switch fully to the blue team perspective: Detection rules, Sysmon configuration, and incident response procedures. Time to hunt these handlers!

Follow me for Part 6!


πŸ’¬ Discussion Question

Which invocation method do you think is most dangerous from a social engineering perspective? Documents, browser links, or something else?


#Cybersecurity #Phishing #SocialEngineering #BlueTeam #BYOPH #DocumentSecurity #BrowserSecurity #ThreatHunting #InfoSec #SecurityAwareness