Git Product home page Git Product logo

xss-php's Introduction

xss-php

This repository contains a XSS vulnerable (simple) guestbook application (src-vuln). A fixed version is provided as well (src-fixed). This example requires a SQL database and a webserver to run. It was created as an exercise for a security course at university.

Application Overview

        ┌────────────────────────┐                    
        │ Guestbook page         │                    
        │ (index.php)            │                    
        └────────────────────────┘                    
                     ▲                                
                     │                               
         Fetch data and display it                    
                     │                                 
        ┌─────────────────────────┐                   
        │ MySQL Database          │                   
        └─────────────────────────┘                   
                     ▲                                
                     │                                 
         Insert data w/o sanitizing input (Fixed      
         version: w/ sanitizing input)                
                     │                                 
        ┌─────────────────────────┐                   
        │ Add Comment page        │                   
        │ (jumbotron-add.php)     │──┐                
        └─────────────────────────┘  │                
                     ▲               │                
                     │               │                
                     └───────────────┘                
                     Submit Form via Post             
                     Page prints inserted comment, if 
                     an error occured.                
                                                      
                                                      
Created with Monodraw                                 

Vulnerabilities

The vulnerable version of the application tries to store the user input directly into the database. (Stored XSS, as the guestbook page simply prints the values take from the database.) In case the database is not able to store the data, an error is returned and the submitted message is printed. (Reflected XSS, as input leading to an error message will be printed as well and could contain executable code.)

Fix

In the fixed version of this application htmlentities( SubmittedValue, ENT_QUOTES ) is used to convert special characters into their html representation. (http://php.net/manual/de/function.htmlentities.php)

xss-php's People

Contributors

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