Problem/Motivation

Language negotiation allows to link a language to a separate domain.
A non-trusted user with the 'administer languages' permission, could be using this as a way to create a phishing attack.

Proposed resolution

Mark the "administer languages" permission as restricted, so people managing permissions can understand this is a permission that shouldn't be given to untrusted roles.

Remaining tasks

None.

User interface changes

In the permissions page, "administer languages" will show a warning.

Introduced terminology

None.

API changes

None.

Data model changes

None.

Release notes snippet

None.

Original report

This was originally reported by @mlhess: https://security.drupal.org/node/155183 . This does not pose serious threats e.g. making redirection to external domains possible and was considered appropriate to be handled publicly.

---
(Original report:)

1. give user A permission 'administer language'
2. as user A go to /admin/config/regional/language and enable a second language
3. go to admin/config/regional/language/configure and enable the URL detection method
3. go to /admin/config/regional/language/detection/url and set "Part of the URL that determines language" to "Domain"
4. Go back to admin/config/regional/language, edit the language you enabled above, and enter a domain of your choice in the "'Language domain" field.
5. Eventually (depends on caching) users will end up at your domain. (For example, if you enable the Language Switcher block provided by Drupal core, the link for the above language will point to the above external domain.)

This works. It does not require a trusted permission, but "Administer language" Should be is my guess.

---
(@David_Rothstein's comment)

So there are a couple different ways you can fake a user browsing site A into visiting evil site B:

1. "Malicious redirect" - a link points to a URL at site A, but when you go to that URL you are redirected to site B.
2. "Malicious link" - a link on site A points to site B directly, but the wording/placement of the link on the site strongly suggests it's an official link that will keep you on site A.

I guess you can make an argument that #1 is worse than #2 (though for the average web user I'm not sure it matters). But there's no way we can consider #2 a vulnerability, at least in the case where the attacker's permissions on the site already allow them to modify the site's "official" content... We'd have to mark half the permissions in Drupal as "restrict access" :)

The issue summary here is a bit vague about which this is, but in my testing (I only tested with Drupal 7) I could only produce #2 ("malicious link") with this issue, never an actual redirect. Can anyone else confirm that?

---

CommentFileSizeAuthor
155183-D8.patch342 bytesdokumori
155183-D7.patch453 bytesdokumori

Issue fork drupal-3076793

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

dokumori created an issue. See original summary.

JvE’s picture

The basic attack scenario I envisioned was:
1. As user with administer language permission uses the domain trick to send all language X traffic to a similar domain, running a proxy to the original language domain.
2. Alert the administrator that language X doesn't work on the site.
3. Administrator goes to the site, switches to language X, sees that indeed the language doesn't switch.
4. Admin logs in (the switch logged him/her out if they were already logged in) to investigate/fix it and their credentials are captured by the proxy.
5. Proxy triggers script that restores the original functionality and redirects admin to original site.

Contrived? Unrealistic? Far-fetched? Yeah, probably.
Dangerous? To inattentive admins in a hurry perhaps.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Active » Postponed (maintainer needs more info)

Wonder if still an issue on D11 after 6 years?

penyaskito’s picture

Status: Postponed (maintainer needs more info) » Active

This is still needs a proper resolution.

a) Add a new restricted permission for language.negotiation_url route, flagged with "restrict access".
b) Flag "administer languages" as "restrict access".
c) Change nothing, but document this in language.permissions.yml?
d) Do nothing.

I tempt to think that c is the right one.

gábor hojtsy’s picture

Flag "administer languages" as "restrict access".

I think this makes the most sense.

penyaskito’s picture

Status: Active » Needs review
Issue tags: +Security improvements

Easy enough to fix in the browser and test on tugboat :-)

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs issue summary update

Can we update the issue summary still though please

Thanks!

penyaskito’s picture

Issue summary: View changes
Status: Needs work » Needs review
Issue tags: -Needs issue summary update
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Thanks. Rest seems good

quietone’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs title update

Unfortunately, this is a long title that does not describe the change. See List of issue fields.

greggles’s picture

Title: The language code handling makes it possible for users with 'administer language' to arbitrarily alter a site's URL for different languages » Document that 'administer language' is an important permission controlling site urls
Status: Needs work » Needs review
Issue tags: -Needs title update

Maybe like this?

quietone’s picture

Status: Needs review » Reviewed & tested by the community

Much better, thanks. Restoring the RTBC.

  • catch committed 1ab367a2 on 10.5.x
    Issue #3076793 by penyaskito, dokumori, smustgrave, quietone, gábor...

  • catch committed c735c609 on 11.x
    Issue #3076793 by penyaskito, dokumori, smustgrave, quietone, gábor...
catch’s picture

Version: 11.x-dev » 10.5.x-dev
Status: Reviewed & tested by the community » Fixed

Committed/pushed to 11.x and cherry-picked to 10.5.x, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.