REST API – Too much exposure!
-
I accidentally read something about the new Json WP (v2) api exposing author data. Try this:
yourwebsite.com/wp/v2/users
. It only outputs details of published authors – but includes additional info which our authors had chosen not to make public.Experimenting with other requests, I found that
/wp/v2/media
outputs the entire media library, including brand-new additions which are unattached. We pay for these images, I don’t want to provide the full directory for free downloads!I applied this fix (in my custom plugin, or functions.php would work)
add_filter( 'rest_endpoints', function( $endpoints ){ if ( isset( $endpoints['/wp/v2/users'] ) ) { unset( $endpoints['/wp/v2/users'] ); } if ( isset( $endpoints['/wp/v2/users/(?P<id>[\d]+)'] ) ) { unset( $endpoints['/wp/v2/users/(?P<id>[\d]+)'] ); } if ( isset( $endpoints['/wp/v2/media'] ) ) { unset( $endpoints['/wp/v2/media'] ); } if ( isset( $endpoints['/wp/v2/media/(?P<id>[\d]+)'] ) ) { unset( $endpoints['/wp/v2/media/(?P<id>[\d]+)'] ); } return $endpoints; });
While I can see why you’re so excited about all this, WordPress, you haven’t publicised the vulnerabilities. Most bloggers won’t even know this development has happened, let alone how easy it is to access.
I’m only a part-time, as-needed developer working on a single blog. It was pure chance that I happened on the information. While I do know how to use Json, examining your whole API for nasty surprises is beyond my scope. Please make sure we all know the details!
- The topic ‘REST API – Too much exposure!’ is closed to new replies.