Coder Social home page Coder Social logo

php-analyzer's Introduction

php-analyzer

Current performance:
2022/05/28 12:41:35 Scanned 4981 files Found 428 vulns In time 25.159522618s

Input is filenames or URLs of PHP files.

Output is the PHP representation of the vertex of the assignment or sink and it's line:char position, along with the traced stack for each step in the path.

To do:

  • HTML context awareness
  • Don't traverse tree multiple times (and dont traverse dead code)
  • Scan whole repos instead of files (this will require more WP research)

Example:

$ echo test.php | php-analyzer -yaml
file: test.php
type: xss
path:
- stack: '[assign] $user_input <- [taint] $_GET'
  code: $user_input = $_GET['input'] 11:194
- stack: '[assign] $improperly_filtered <- [filter] MAGICQUOTES <- [taint] $user_input'
  code: $improperly_filtered = "$user_input" 12:224
- stack: '[sink] echo <- [taint] $improperly_filtered'
  code: |-
    // this does alert because magic quotes dont stop xss
    echo $improperly_filtered; 20:444

file: test.php
type: sqli
path:
- stack: '[assign] $t <- [assign] $param <- [taint] $_GET'
  code: $d->dangerous($_GET) 14:282
- stack: '[assign] $temp <- [filter] unknown_filter_func <- [taint] $param'
  code: $temp = unknown_filter_func($param) 4:51
- stack: '[assign] dangerous <- [taint] $temp'
  code: return $temp; 7:174
- stack: '[assign] $t <- [taint] dangerous'
  code: $t = $d->dangerous($_GET) 14:277
- stack: '[sink] query <- [taint] $t'
  code: |-
    // alerts because taint follows through method call into $t
    query($t) 23:532

2022/06/01 18:42:23 Scanned 1 files	Found 2 vulns	In time 4.785042ms

Help:

$ ./php-analyzer -h
Usage of ./php-analyzer:
  -d int
    	Number of times to traverse the tree (Tracing through function calls requires multiple passes) (default 10)
  -f string
    	Specify a data file of sources, sinks, and filters (default "data.yaml")
  -t int
    	Number of goroutines to use (default 100)
  -yaml
    	Output as YAML, (JSON by default)

php-analyzer's People

Contributors

garlic0x1 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.