Problem/Motivation
reported by: https://www.drupal.org/u/willzyx
STR:
Users with 'Create|Delete|Edit translations' permission can access the translation overview page of an entity (and see some entity info) even if they can't access to the entity itself.
This because content translation access checking, never takes into account if user can access the entity, when grants access to the entity translation overview page.
On a clean installation - standard profile:
1) Enable content_translation and language modules
2) Add a language in admin/config/regional/language
3) Enable translation for Article content type in admin/config/regional/content-language
4) Grant 'Create translations' permission to 'authenticated user' role
5) Revoke 'View published content' permission to 'authenticated user' role
6) Create an Article node (node/1)
7) Login as a user with only 'authenticated user' role
8) Go to node/1/translations. You can see the translation overview and some entity info
This bug does not affect Drupal 7 because the access callback for the translation overview page explicitly calls node_access() for determine if the user can access (see _translation_tab_access())
Proposed resolution
Add an additional check that the user can access the node before allowing them to access the translation form.
Remaining tasks
User interface changes
n/a
API changes
none
Data model changes
None
original report was part of the Drupal 8 bug bounty
https://tracker.bugcrowd.com/drupal/submissions/465314
reported by: https://www.drupal.org/u/willzyx
Beta phase evaluation
| Issue category | Bug, since it's a security hole |
|---|---|
| Issue priority | Critical or maybe downgrade to major since while we would probably issue a SA for this after release, it requires a very unusual configuration. |
| Prioritized changes | The main goal of this issue is security |
| Disruption | Not disruptive. |
| Comment | File | Size | Author |
|---|---|---|---|
| #35 | interdiff.txt | 709 bytes | dawehner |
| #35 | 2558905-35.patch | 16.56 KB | dawehner |
| #33 | interdiff.txt | 1.53 KB | dawehner |
| #33 | 2558905-33.patch | 16.56 KB | dawehner |
| #32 | increment.txt | 1.18 KB | pwolanin |
Comments
Comment #2
pwolanin commentedFirst patch, though I'm not 100% sure the permission construction is generically correct.
Comment #3
pwolanin commentedShould add tests to check the 2 modified routes following the STR
Comment #5
cilefen commentedA basic test of the base route.
Comment #6
pwolanin commentedNot seeing an obvious way to add a generic "view" check for any entity type. This might be failing since the test entity just has access TRUE.
Comment #7
legolasboWaking up testbot for #5
Comment #9
plachWhat about adding that only to node? It's only node that exposes the "problematic" permission atm...
Comment #10
wim leersDoesn't it make sense to always have content translation require that you can view the entity before you can translate it?
view AND translateas the requirements to access translations makes a ton of sense to me, and is exactly what this patch does.So, can you clarify why you think this should only be done for nodes?
Comment #11
plachWell, it was a response to:
but obviously having it working for any entity type would be more desirable. I'll have a look to those failures later...
Comment #12
cilefen commentedTo cause this you need a silly misconfiguration of permissions. It's almost "works as designed". I don't think this is critical.
Comment #13
willzyx commentednot at all. Sure, The steps to reproduce the issue produce an "extreme" permissions configuration case, but it is just to show the bug.
Users with 'Create|Delete|Edit translations' permission can access the translation overview page even if they can't access to the entity itself; and this include unpublished entity or entity that some content access module protects. And these cases are not related to a permission misconfiguration.
Another example that shows the bug: on a clean installation - standard profile:
1) Enable content_translation and language modules
2) Add a language in admin/config/regional/language
3) Enable translation for Article content type in admin/config/regional/content-language
4) Grant 'Create translations' permission to 'authenticated user' role
6) Create an Article node (node/1) and unpublish it
7) Login as a user with only 'authenticated user' role
8) Go to node/1/translations. You can see the translation overview and some entity info
Comment #14
plach@willzyx:
Thanks for the detailed description, those steps might be useful to provide additional test coverage, or at least improve the current one :)
Comment #15
dawehnerThis is basically what the patch in #2558905-5: Content translation module - Information disclosure by insufficient access checking adds as test coverage.
I don't get that statement. Its just a bug in entity_test.routing.yml that we don't add the required access checking.
This is one of the reasons why #2350509: Implement auto-route generation for all core entities and convert all of the core entities. is kinda important. It allows us to standardize more.
Other test failures can be fixed by providing the needed permissions.
Comment #17
willzyx commented@dawehner in the test I see:
the comment is wrong and probably the test should be updated. We are not talking of misconfiguration of permissions, the steps to reproduce in 13 (if you read it carefully :)) show that the bug is reproducible without a "particular" permissions configuration
Comment #18
dawehnerOh I see what you mean ...
Let's expand the test coverage for that.
Comment #20
dawehnerWe could do the following:
Comment #22
dawehnerSeriously testbot ...
Comment #23
dawehnerBut seriously dawehner :)
Comment #25
pwolanin commentedLooks good, except I 'm not sure about requiring admin permission here:
Maybe we should re-use the code from update - that seems to be checking view access by checking the the route is accessible?
Comment #26
dawehnerWell, this is about route access, so we can't really forward to the route access.
Comment #27
pwolanin commentedGiven that the other check requires 'administer menu' access, that seems reasonable.
These should use
Url::fromRoute()in a couple spots in the test:Comment #28
larowlanThis looks ready to me, couple of minor issues that could be resolved on commit.
With regards to use of paths in tests, I think that we're ok
exteme nit™: not needed (can be removed on commit)
Do we normally reference issues in tests? Only for security?
Comment #29
dawehnerWell, I think we should, it gives more information ...
Addressed 27 as well.
Comment #30
willzyx commentednot sure if is in the scope of this issue but I think we should also take in account
content_translation_translate_access()and consider to add an entity access check. It seems to suffer of the same bug, since no explicit entity access check is done in this functionComment #31
pwolanin commentedSeems like itt's part of the same bug. though looking at uses it may just be exposing links. Still, I think it's reasonable to add a view check.
Comment #32
pwolanin commentedLike so? Needs a test maybe?
Comment #33
dawehnerSure, why not
Comment #34
plachLooks good to me, thanks! RTBC +1
If we happen to reroll this:
typo
Comment #35
dawehnerThank you plach
Yeah let's quick fix that.
:)
Comment #36
alexpottNice tests and nice find @willzyx. Committed 112e9bf and pushed to 8.0.x. Thanks!