A significant security flaw was recently identified in Microsoft 365’s Export to PDF functionality, potentially allowing unauthorized access to sensitive server-side data. This Local File Inclusion (LFI) vulnerability could have exposed critical information such as configuration files, database credentials, and application source code.
Discovery and Reporting
Security researcher Gianluca Baldi uncovered this vulnerability during a client web application assessment. The assessment involved a feature that converted documents into PDF format via Microsoft 365 SharePoint integration. Baldi’s findings were reported to Microsoft, leading to a patch and a $3,000 bounty reward for his contribution to enterprise security.
Technical Details
The vulnerability exploited an undocumented behavior in Microsoft Graph APIs, which support PDF conversion from various formats, including CSV, DOC, DOCX, and others. Notably, an unexpected HTML-to-PDF conversion capability was discovered, creating an unforeseen attack vector.
This conversion process lacked proper input validation and file path restrictions, enabling path traversal attacks that could access files outside the server’s designated root directory. Attackers could embed malicious HTML tags such as `
Exploitation Process
The exploitation involved three primary steps:
1. Uploading Malicious HTML Content: An attacker uploads a specially crafted HTML file containing malicious tags pointing to sensitive system files like `web.config` or `win.ini`.
2. Initiating PDF Conversion: The attacker requests the conversion of the malicious HTML file to PDF format via the Microsoft Graph API.
3. Retrieving the Compromised PDF: The resulting PDF, now containing the contents of the targeted server files, is downloaded by the attacker.
This method effectively bypassed standard security controls and file access restrictions, posing a significant risk to data confidentiality.
Potential Impact
The implications of this vulnerability were far-reaching:
– Exposure of Sensitive Information: Access to configuration files and database credentials could lead to unauthorized data access and potential system compromise.
– Application Source Code Disclosure: Revealing source code can expose proprietary logic and facilitate further attacks.
– Cross-Tenant Data Exposure: In multi-tenant environments, this flaw could have led to unauthorized access to data across different organizations.
Recognizing the severity, the Microsoft Security Response Center (MSRC) rated this vulnerability as Important, underscoring its potential for significant data breaches.
Mitigation Measures
In response to the discovery, Microsoft implemented several measures to address the vulnerability:
– Input Validation: Enhanced validation processes were introduced to scrutinize and sanitize user inputs, preventing malicious content from being processed.
– File Path Restrictions: Strict controls were established to prevent directory traversal attacks, ensuring that file access remains within designated directories.
– HTML Tag Processing Limitations: The processing of certain HTML tags during PDF conversion was restricted to mitigate the risk of unauthorized file inclusion.
These steps were crucial in securing the document conversion features of Microsoft 365 and protecting users from potential exploits.
Broader Context
This incident highlights the importance of continuous security assessments and prompt patching in enterprise environments. It also underscores the value of responsible disclosure programs, where researchers and organizations collaborate to enhance cybersecurity.
Organizations are advised to stay vigilant, regularly update their systems, and educate users about potential security risks associated with document processing features.