目标达成 感谢每一位支持者 — 我们达成了 100% 目标!

目标: 1000 元 · 已筹: 1336

100%

CVE-2019-9787 PoC — WordPress 跨站请求伪造漏洞

来源
关联漏洞
标题: WordPress 跨站请求伪造漏洞 (CVE-2019-9787)
Description:WordPress是WordPress基金会的一套使用PHP语言开发的博客平台。该平台支持在PHP和MySQL的服务器上架设个人博客网站。 WordPress 5.1.1之前版本中存在安全漏洞,该漏洞源于程序没有正确地过滤评论内容。远程攻击者可利用该漏洞执行代码并控制WordPress网站。
介绍
# mitigation-cve-2019-9787
# POC 
1. simply xss :<script>alert('xss');</script>
2. simple csrf: attacker's website code--- https://github.com/kuangting4231/wordpress.github.io
3. csrf remote code execution: attacker's website code--- https://github.com/kuangting4231/assigment1.github.io


# mitigation
1. fix the logic flaw in the sanitization process for administrators. 
add the two line in /wp-admin/includes/ajax-actions.php and /wp-includes/comment.php(detail in the report)
remove_filter( 'pre_comment_content', 'wp_filter_post_kses' );
add_filter( 'pre_comment_content', 'wp_filter_kses' );
2. http-only
For session cookies managed by PHP, the flag is set either permanently in php.ini PHP manual on HttpOnly through the parameter:

session.cookie_httponly = True

3. hash-based defence
   CSRF validation token has not been implemented in WordPress because if done, it would hinder the trackbacks and pingbacks features of WordPress. Server cannot        distinguish illegal CSRF request from legal PINGBACK/TRACEBACK request, wordpress automatically accept comment without correct CSRF-token as a PINFBACK and TRACEBACK request and filter that comment with a white-list filter.

   To defence this CSRF vulnerability, we add a new field in the form called hashnonce to verify that the comment is send by administrator. The admin sign a signature on the value of comment field with their cookie.

   The signature of the value of comment field used md5 to generated the hash value(see graph ).

   When admin tries to adopt PINFBACK and TRACEBACK and the _wp_unfiltered_html can not be provided, we use the wp_verify_hashNonce. If the validation fails, an error will be reported. Even if the validation is successful, the logic error has been corrected and "wp_filter_kses" will be used to filter comments.

   Code modified:
   1. comment-template: js script calculate and add hashNonce script;
   2. pluggable: PHP script added verify hashNonce script.
   3. comment: PHP script changed the request process logic.

   the third method is change from https://github.com/sijiahi/Wordpress_cve-2019-9787_defense
文件快照

登录后查看神龙缓存的 POC 文件快照

登录查看
备注
    1. 建议优先通过来源进行访问。
    2. 本地 POC 快照面向订阅用户开放;当原始来源失效或无法访问时,本地镜像作为订阅权益的一部分提供。
    3. 持续抓取、验证、维护这份 POC 档案需要不少投入,因此本地快照已纳入付费订阅。您的订阅是让这份资料能继续走下去的关键,由衷感谢。 查看订阅方案 →