DrupalBin
Submit Code
About
Recent Posts
Code
6 min 11 sec
ago
Code
21 min 48 sec
ago
css path
2 hours 6 min
ago
Fix for Code
6 hours 5 min
ago
more
Tags
CCK
drupal
fapi
jquery
menu
module
Panels
php
simpletest
test
theme
views
more tags
User login
Log in using OpenID:
What is OpenID?
Username:
*
Password:
*
Create new account
Request new password
Log in using OpenID
Cancel OpenID login
Home
Fix for Xss injector
View
Download
Fix
This fix will not be saved to the database until you submit.
Summary:
Tags:
Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Source code:
*
function page_xss_injector() { for($i=0;$i<2;$i++) { // Extract the forms url and id $form_details = db_fetch_array(db_query("SELECT f.id,l.path FROM {crawler_forms} f INNER JOIN {crawler_links} l ON f.page_id = l.id WHERE status = 2 LIMIT 1")); // Visit that url $obj = new drupal_security_scanner_test(); $session_cookie = variable_get('security_scanner_cookie',''); $obj->curl_options = array( CURLOPT_COOKIE => $session_cookie, ); //$obj->drupalGet($form_details['path']); $obj->drupalGet('http://localhost/soc2008/?q=node/add/page'); $obj->parse(); // Selecting the form that has the id that i already saved into the db(this is because sometimes there are 2 forms inside the same page) $textfields = $obj->elements->xpath("//input[@id='edit-page-node-form']/parent::*"); /// --- [@type='textarea'|@type='textfield'] foreach ($textfields as $text) { // Selecting only textareas and input type = 'text' before seeding $all_inputs = $text->elements->xpath("//input[@type='text']|//textarea"); foreach ($all_inputs as $input) { $name = (string)$input->attributes()->name; $form_state['values'][$name] = "<script>alert('xss');</script>"; } } $return = drupal_execute($form_details['id'], $form_state); } }
Syntax highlighting mode:
ActionScript
ColdFusion
Diff
Drupal
Drupal 5
Drupal 6
HTML
Javascript
MySQL
PHP
Python
robots.txt
SQL
Text
Select the syntax highlighting mode to use.