Giter Club home page Giter Club logo

progpilot's Introduction

progpilot

A static analyzer for security purposes
Only PHP language is currently supported

Build Status Packagist Packagist

Installation

Option 1: use standalone phar

  • Download the latest phar archive from the releases page.
  • Place the file somewhere in your path and make it executable:
chmod +x progpilot_vX.Y.Z.phar
sudo mv progpilot_vX.Y.Z.phar /usr/local/bin/progpilot

Option 2: build phar from source code

phar-composer.phar should be located in a directory listed in the $PATH environment variable before starting the build:

git clone https://github.com/designsecurity/progpilot
cd progpilot
./build.sh

The resulting phar archive will be located in the builds folder at the root of this project.

Option 3: use composer

Use Composer to install progpilot:

composer require --dev designsecurity/progpilot

Configuration

Use a yaml configuration file (look at this example) to configure and customize the progpilot analysis otherwise the default configuration will be used with, in particular the standard taint configuration data.

Usage

CLI example

The progpilot command takes as arguments the path to the files and folders to be analyzed and optionally a configuration file:

# without config file
progpilot example1.php example2.php folder1/ folder2/
# with a config file
progpilot --configuration configuration.yml example1.php example2.php folder1/ folder2/

If you installed it with composer, the program will be located at vendor/bin/progpilot.

Library example

It is also possible to use progpilot inside PHP code. For more information look at the API documentation.

Use this code to analyze source_code1.php:

<?php
require_once './vendor/autoload.php';

$context = new \progpilot\Context;
$analyzer = new \progpilot\Analyzer;

$context->inputs->setFile("source_code1.php");

try {
  $analyzer->run($context);
} catch (Exception $e) {
   echo "Exception : ".$e->getMessage()."\n";
}  
  
$results = $context->outputs->getResults();

var_dump($results);

When source_code1.php contains this code:

<?php
$var7 = $_GET["p"];
$var4 = $var7;
echo "$var4";

The simplified output will be:

array(1) {
  [0]=>
  array(11) {
    ["source_name"]=>
    array(1) {
      [0]=>
      string(5) "$var4"
    }
    ["source_line"]=>
    array(1) {
      [0]=>
      int(4)
    }
    ["sink_name"]=>
    string(4) "echo"
    ["sink_line"]=>
    int(5)
    ["vuln_name"]=>
    string(3) "xss"
  }
}

All files (composer.json, example1.php, source_code1.php) used in this example are in the projects/example folder. For more examples look also at this page.

Specify an analysis

It is strongly recommended to customize the taint analysis configuration (the definitions of sinks, sources, sanitizers and validators) according to the context of the application to be analyzed. In the following specification, superglobals variables _GET, _POST or _COOKIE are defined as untrusted and also the return of the shell_exec() function:

{
    "sources": [
        {"name": "_GET", "is_array": true, "language": "php"},
        {"name": "_POST", "is_array": true, "language": "php"},
        {"name": "_COOKIE", "is_array": true, "language": "php"},
        {"name": "shell_exec", "is_function": true, "language": "php"}
    ]
}

See available settings in the corresponding chapter about specifying an analysis.
Custom rules can be created too, see the corresponding chapter about custom rules.

Development

Learn more about the development of Progpilot.

Faq

Here

progpilot's People

Contributors

eric-therond avatar nicolascarpi avatar glazermann avatar designsecurity 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.