News Feed
Jobs Feed
Sections

Recent Jobs

News Archive
feed this:

HowTo Forge:
Intrusion Detection For PHP Applications With PHPIDS
June 24, 2008 @ 10:22:04

On the HowTo Forge website, there's a recently posted article about using the IDS tool for PHP to help with intrusion detection for your website.

This tutorial explains how to set up IDS tool on a web server with Apache2 and PHP5. PHPIDS (PHP-Intrusion Detection System) is a simple to use, well structured, fast and state-of-the-art security layer for your PHP based web application. The IDS neither strips, sanitizes nor filters any malicious input, it simply recognizes when an attacker tries to break your site and reacts in exactly the way you want it to.

They show the steps you'll need to get things installed and working as well as some of the configuration changes you'll need to add/make (including the creation of an auto-prepend file to make using it all over easy).

0 comments voice your opinion now!
intrusion detection phpids application tutorial install configure



Sebastian Bergmann's Blog:
On PHPUnit and Software Metrics
February 08, 2008 @ 09:31:00

In one of his latest entries, Sebastian Bergmann answers a question from another blogger about the future of software metrics and project mess detection as a part of the PHPUnit project.

When I started to work on these projects, there was no other place for me then to develop them as part of PHPUnit. [...] But the more I thought about it, I realized that these features do not belong into PHPUnit but into a suite of tools that PHPUnit is a well-integrated part of.

He did, however, include it as a part of the PHPUnit 3.2 release at that time. Now, however, there are the tools and platforms to make those tests useful outside of the PHPUnit environment and is allowing him to move it out from the testing application and on to closer integration with other software.

0 comments voice your opinion now!
phpunit software metrics project mess detection integration


Sebastian Bergmann's Blog:
Copy & Paste Detection in PHPUnit 3.2
August 22, 2007 @ 09:31:00

Sebastian Bergmann spotlights another feature of the upcoming PHPUnit version 3.2 - the inclusion of a Project Mess Detector's ability to help find duplicate code.

Duplicate code can be hard to find, especially in a large project. Johann-Peter Hartmann of MAYFLOWER GmbH recently implemented Copy & Paste Detection for PHPUnit's growing set of features that extends its usage scenarios beyond "just unit testing" to a one-stop solution for quality assurance in PHP-based projects.

In his example, Sebastian shows what the response will look like when the tests find duplicate code - giving details like the files involved and the code fragment that was duplicated.

Check out this list in another post on Sebastian's blog for more of the metrics that will be included in the upcoming version.

1 comment voice your opinion now!
phpunit unittest metric software copyandpaste detection mess detector phpunit unittest metric software copyandpaste detection mess detector


Tutorial:
An Introduction to PHPIDS (PHP-Intrusion Detection System)
June 19, 2007 @ 15:28:56

After several weeks of work Mario Heiderich, Lars Strojny and of course myself released the first stable versions of the PHPIDS - currently at version 0.2.2.

You will find the project site on http://php-ids.org/

In this article I would like to present our framework and explain how it can be used, hoping that developers consider it useful to make their application more secure.

The PHPIDS is a system that is meant to be an additional layer of security for any PHP based website or web application. In fact, this layer does not filter input - that would be a task for different layers - but it makes sure that no potential attack against the application goes unnoticed.

Based on a collection of heavily tested regular expressions the PHPIDS is able to efficiently recognize, classify and ultimately react on many different kinds of attacks - including, besides others, XSS, SQL injection, directory traversal, String.fromCharcode attacks, halfwidth/fullwidth encoding attacks and remote code execution. Due to its flexible and easy configuration the PHPIDS reaction will happen in exactly the way the developer intends.

The integration is as simple as can be. Besides PHP 5.2 the only necessary extension is SimpleXML and the following code:


<?php
set_include_path
('../../lib/');
require_once 
'IDS/Monitor.php';
require_once 
'IDS/Filter/Storage.php';

try {

    
// instanciate the storage object and fetch the rules
    
$storage = new IDS_Filter_Storage();
    
$storage->getFilterFromXML('../../lib/default_filter.xml');
    
    
/*
    * Instanciate the IDS and start the detection
    * 
    * here we are using $_GET but you can pass any 
    * array you want like $_SERVER, $_SESSION etc.
    */
    
$get = new IDS_Monitor($_GET$storage);
    
$report $get->run();

    if (!
$report->isEmpty()) {
        
        
// Get the overall impact
        
echo "Impact: {$report->getImpact()}n";
        
        
// Get array of every tag used
        
echo 'Tags: ' join(', '$report->getTags()) . "n";
        
        
// Iterate through the report and get every event (IDS_Event)
        
foreach ($report as $event) {
            echo 
"Variable: {$event->getName()} | Value: {$event->getValue()}n";
            echo 
"Impact: {$event->getImpact()} | Tags: " join(", "$event->getTags()) . "n";
            
            
// Iterator throught every filter 
            
foreach ($event as $filter) {
                echo 
"Description: {$filter->getDescription()}n";
                echo 
"Tags: " join(", "$filter->getTags()) . "n";
            }
        }
    }
    
    
/*
    * Additionally you have the option to store the detected
    * data using IDS_Log_Composite and for example IDS_Log_File
    */
    
require_once '../../lib/IDS/Log/File.php';
    require_once 
'../../lib/IDS/Log/Composite.php';
   
    
$compositeLog = new IDS_Log_Composite();
    
$compositeLog->addLogger(
       
IDS_Log_File::getInstance('log.txt')
    );
    
    if (!
$report->isEmpty()) {
        
$compositeLog->execute($report);
    }

} catch (
Exception $e) {
    
printf(
        
'An error occured: %s',
        
$e->getMessage()
    );
}
?>

Ideally the PHPIDS should be included in a central position of the application or even better via auto_prepend_file. If an attack takes place the IDS result object will be returned filled with data and the programmer can decide the appropriate reaction. For the most part decisions about the reaction are dependent on the detected attacks' cumulative impact.

The impact variable acts as an indicator for an attack's severity and can be used to grade the application's reaction on that attack. For example, if the impact was 3, an appropriate response might be to log the issue in a file, whereas if the impact was around 12, a warning mail to the site owner might be more applicable whilst an impact of 24 or above might print out a message to the attacker stating that his intrusion attempt has been detected and request aborted.

The PHPIDS is heavily tested via phpUnit and profiles via xdebug meaning that you can expect a minimal performance hit to your applications. We are currently using the PHPIDS with great success on several high traffic sites; ormigo.com and neu.de being the two foremost examples of this. Documentation and support is available on the project site or via our forum. Future development for the PHPIDS will possibly rank around detection of fragmented XSS and enhanced detection of heavily encoded attack vectors.

For users of .NET there's the .NETIDS written by Martin Hinks which is a port of the PHPIDS and uses the same filter rules. You will find any related resources on the .NETIDS project page (http://code.google.com/p/dotnetids/). Support for the .NETIDS is also available in the PHPIDS forum.

Regards, Christian Matthies & Mario Heiderich

1 comment voice your opinion now!
tutorial article phpids intrusion detection system tutorial article phpids intrusion detection system



Community Events











Don't see your event here?
Let us know!


database conference ajax application zend zendframework developer cakephp PHP5 package framework PEAR mysql code security release book example releases job

All content copyright, 2008 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework