Skip to content

Instantly share code, notes, and snippets.

@trepmal
Last active September 5, 2024 01:39
Show Gist options
  • Save trepmal/5753200 to your computer and use it in GitHub Desktop.
Save trepmal/5753200 to your computer and use it in GitHub Desktop.
See how many widgets are not escaping properly.
<?php
add_filter( 'widget_display_callback', 'exploit_widget_display_callback', 10, 3 );
function exploit_widget_display_callback( $instance, $widget_obj, $args ) {
foreach( $instance as $k => $v )
$instance[ $k ] .= '<script>alert("'.esc_js( $widget_obj->name ." \n". $widget_obj->id ) .'");</script>';
return $instance;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment