Giter Site home page Giter Site logo

pwaf's Introduction

pwaf

php waf extension filter webshell

Requirement

  • PHP-7.0 +

download

git clone [email protected]:snfnwgi/pwaf.git

Compile in Linux

$/path/to/phpize
$./configure --with-php-config=/path/to/php-config/
$make && make install

Example

目前只过滤了exec方法,后续慢慢完善

<?php
exec($_GET['webshell']);//用exec执行GET或POST用户输入的信息都不会执行成功,并会记录日志(/tmp/pwaf.log).
//log file
[filename]: /vagrant_data/test/pwaf.php
[function]: exec
[line]: 3
[date]:2017-8-2 19:7:52

背景

1.webshell 单纯用PHP代码过滤总是防不胜防,各种webshell的变种.唯独在扩展层面最有效,因为不管webshell怎么变形,最终都会交给zend vm处理,zend 提拱了重写opcode接口(zend_set_user_opcode_handler),在编写扩展时我们可调用接口做自己的想做的事情.
2.为了怕误报webshell,采用了用日志记录的方式(文件名,行号,执行函数,时间),如果真的有误报了,改写代码写法(用户输入的过来的数据认为是危险操作)
3.在研究了一段时间后发现有类似扩展,(代码中有些借鉴了教主鸟哥的taint**)

相关资料

1.taint:https://github.com/laruence/taint
2.各种PHP变形webshell:https://github.com/tennc/webshell/tree/master/php

pwaf's People

Contributors

snfnwgi avatar

Watchers

James Cloos avatar William Chen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.