Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/22/2013 04:38:44 AM (13 years ago)
Author:
johnjamesjacoby
Message:

In the AJAX object_template_loader() functions of bp-default and bp-legacy, use sanitize_title() instead of esc_attr() to properly sanitize the requested object.

Then, do a bp_is_active() against that object to ensure the object being requested is for an active component, to prevent potential arbitrary file inclusion. (Note: this needs testing with third party components that tap into this functionality, as it was originally intended only to be used by bundled components.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-themes/bp-default/_inc/ajax.php

    r7015 r7095  
    169169        return;
    170170
     171    // Bail if no object passed
     172    if ( empty( $_POST['object'] ) )
     173        return;
     174
     175    // Sanitize the object
     176    $object = sanitize_title( $_POST['object'] );
     177
     178    // Bail if object is not an active component
     179    if ( ! bp_is_active( $object ) )
     180        return;
     181
    171182    /**
    172183     * AJAX requests happen too early to be seen by bp_update_is_directory()
     
    175186     * of themselves rather than the directory version.
    176187     */
    177 
    178188    if ( ! bp_current_action() )
    179189        bp_update_is_directory( true, bp_current_component() );
    180 
    181     // Sanitize the post object
    182     $object = esc_attr( $_POST['object'] );
    183190
    184191    // Locate the object template
Note: See TracChangeset for help on using the changeset viewer.