This issue description and patches are originally by tim.plunkett and are for the same security vulnerability as SA-CONTRIB-2014-054 - Views - Access Bypass in the D7 Views module:
view::_init_handler() retrieves the list of handlers from the display plugin, stores it on the view, and checks each for access. However, it does not update the display plugin with the filtered list.
Any code after that which uses view_plugin_display::get_handlers() will have an outdated list.
I discovered this via a custom area handler I was writing. It so happens that no area handlers I've found in the wild are exploitable here, since they either do not have a concept of access, or they manually check access in their render() methods (see views_handler_area_view in Views, or entity_views_handler_area_entity in Entity for examples).
Major code of concern (access plugins, field output) uses $this->view->$key, not $this->view->display_handler->get_handlers($key);, so it is no vulnerable.
Things I've found that are susceptible to this: area handlers, the get_field_labels() method, token replacement, and some relationship handling.
Thankfully the fix is easy.
The patch has already been reviewed on the security issue, but I'm marking as "Needs review" here for wider review.
| Comment | File | Size | Author |
|---|---|---|---|
| #23 | interdiff.txt | 1.66 KB | tim.plunkett |
| #23 | 2272001-vdc-23-PASS.patch | 6.07 KB | tim.plunkett |
| #23 | 2272001-vdc-23-FAIL.patch | 4.8 KB | tim.plunkett |
Comments
Comment #2
dsnopekHrm. Patch applies for me with a tiny bit of fuzz. Here's a re-roll!
Comment #3
dsnopekBlergh! My re-roll was no good, it's missing an added file. This version should be good.
Comment #5
dawehnerwe don't really need 'bool' => TRUE
Comment #6
xjmRerolled for #2247991: [May 27] Move all module code from …/lib/Drupal/… to …/src/… for PSR-4. Edit: I didn't fix #5.
Comment #7
dawehnerBefore we just fix this, we have to take into account all the bugs caused by this security fix.
Comment #8
dsnopek@dawehner: can you give links to the bugs from this fix?
Comment #9
damiankloip commentedRE #5: See our postponed issue - #1922966: Remove 'bool' and 'translatable' key from option definitions
Comment #10
dsnopekHere are the regressions that @dahwehner was referring to:
Comment #11
martin107 commentedStraight reroll. The end of may seems a long time ago
Comment #12
xjmSince this has a disclosed SA, it should be an upgrade path blocker (per #2341575: [meta] Provide a beta to beta/rc upgrade path).
Comment #13
dawehnernote: drupal_render() is already deprecated. use \Drupal::service('renderer')->render() instead.
Note: this does not need 'bool' => TRUE any longer, but rather an update to the views schema for this plugin.
Comment #14
martin107 commented5 weeks is a long time in D8 development ...
Patch still applies, but I am not certain everything will be green
So retesting
Comment #16
devin carlson commentedAn updated version of #11 with the changes from #13 (replacing
drupal_render(), removing'bool' => TRUEand adding a schema forviews.area.test_example).Comment #18
devin carlson commentedFixed wrong file location.
Comment #19
effulgentsia commentedTesting a negative is always a little fragile, since there might be multiple reasons for a certain string to not appear, access being only one of them. Should we also add a test for turning access on and verifying that "a custom string" is present, thereby increasing our confidence that it not appearing was because of a properly functioning access checker?
Comment #20
effulgentsia commentedAlso, I think it would be good for the issue summary to explain why the testing strategy employed here (render and check for what rendered) is different than what was committed to D7 Views. I think it's fine to use a different testing approach for the different versions, but since it's a security issue, I think having a documented record of the reason is valuable.
Comment #21
dawehnerThe actual D7 commit had a really explicit test, we really should have that here.
Given that we should mark this issue as needs work, sorry.
Comment #22
tim.plunkettI wrote the original test, I should be able to recreate it for D8.
Comment #23
tim.plunkettI left in the string-based check as well, but added the explicit checks, and included testing when access is allowed.
Comment #25
dawehnerAlright, the tests now look a little bit more sane.
Comment #26
alexpottCommitted 3dcbc22 and pushed to 8.0.x. Thanks!