When using services_basic_auth 7.x-1.x-dev, if page caching is on and an unauthenticated request (or a request with failed authentication) is made to a services endpoint, that result can become cached, such that _services_basic_auth_authenticate_call() is bypassed and even properly authenticated requests produce an empty response until caches are cleared.
Comments
Comment #1
msupko commentedThis patch seeks to resolve the issue by sidestepping cache for all requests to the endpoint, not just those for which authentication succeeds.
Comment #2
pere orgaThanks. See SA-CONTRIB-2015-050 - Services Basic Authentication - Access bypass - Unsupported
Comment #3
badjava commentedGiven the current state of this module, I re-rolled the patch so that it can be applied cleanly on the 1.1 release while this is being resolved.
Comment #4
markpavlitski commentedThe patch in #1 is a good approach, but the issue can still be triggered when using non-database cache backends, when $conf['page_cache_without_database'] is TRUE, since that bypass the $conf['cache'] check. See: _drupal_bootstrap_page_cache().
The attached patch (based on latest 7.x-dev) forces caching to be disable in that case too.
@Pere Orga I'm happy to take over maintainership of this module to get a secure release out, if required.
Bumping the priority up to critical priority due to SA-CONTRIB-2015-050.
Comment #5
scor commentedShouldn't the patch use drupal_page_is_cacheable()?
Comment #6
markpavlitski commented@scor yes, looking at _drupal_bootstrap_page_cache(), that would work too and makes the code a bit cleaner.
The main thinking on the previous patch was just minimal code changes to fix the problem, since that was the approach being used already.
New patch attached.
Comment #7
skwashd commentedI have tested this locally and the patch at #6 solves the security issue. The docs suggest that
drupal_page_is_cacheable(FALSE)is the correct way to flag a page as being uncachable. RTBC.Comment #9
skwashd commentedThis was committed 10 days ago, marking as fixed.