There is a serious security flaw in the code of field_views_field_default_views_data() function of /views/modules/field.views.inc file: assigning unescaped user input string to the label of the field. I suddenly stumble on it while writing my own custom filter handler. Fortunately, the fix is pretty obvious, so I attached the patch to this issue.
This security issue falls outside of the security advisory policy of the Drupal Security team. The vulnerability can only be exploited if the attacker has an elevated permission "administer fields". Therefore we can fix this in public and no private security report is necessary.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | views-1789360-8.patch | 2.58 KB | klausi |
Comments
Comment #1
RedRat commentedI have tested this patch on my production server and it works fine.
Comment #2
damienmckennaComment #3
damienmckennaThis is only possible if someone has permission to change field names, which requires the "administer field" permission. That permission is considered a special permission that should only be given to trusted users, so this isn't a security problem in the traditional sense.
Comment #4
dawehnerI am a bit confused here ... there are other instances where the field labels are used directly as well.
Comment #5
chris matthews commentedVersion change only.
Comment #6
damienmckennaRerolled.
I'm still tempted to close this as "won't fix" because admin labels of entity types and fields are generally considered admin-only, so if an admin is adding some XSS to your field labels maybe you have other problems?
Comment #7
klausiThis was released as backdrop security fix in https://backdropcms.org/security/backdrop-sa-core-2024-001
Raising priority to critical as this is a small XSS vulnerability, but fortunately can only be exploited by trusted admins as Damien said.
Setting to "needs work" as I think we should do the same fix as Backdrop.
Comment #8
klausiPorted patch from backdrop.
Comment #9
gresko8 commentedThanks for the patch Klausi!
Comment #10
damienmckennaThank you all for working on the fix and reviewing it.
Comment #11
renatog commentedThanks everyone
Was reported years ago but If confirmed that that still happening today and it's really a security issue, since our stable releases are covered by the security advisory policy we must follow this instruction, right?!
Or if isn't considered a security issue, I'd suggest updating the issue title :)
Comment #12
klausiIt is a security issue, but it falls outside of the security advisory policy of the Drupal Security team. The vulnerability can only be exploited if the attacker has an elevated permission "administer fields". Therefore we can fix this in public (not sure why Backdrop issued an advisory).
Clarified that in the issue summary
Comment #13
damienmckennaThanks Klausi.
Put another way - this is a minor security hardening issue for some rare scenarios, rather than a something a non-admin would be able to exploit.
Comment #14
klausiOh hm, @jenlampton replied in Slack that the Backdrop fix is not necessary for Drupal 7 because Views UI has an extra XSS filter that Backdrop does not have anymore. She is right, I tried to exploit this but could not get XSS to trigger when adding a field in the Views UI.
Is there any other place where these field labels are displayed?
Very sorry for the noise here, I should have tested my assumptions fully before escalating here. Downgrading the priority again and setting this back to active.
For the Views module in Drupal 7 I think we should not remove the extra XSS filter in Views UI, even if there could be some double escaping then. Keeping the potential double escaping is the secure choice at this point in the late D7 cycle.
Let me know if you see the XSS trigger and where exactly!
Comment #15
damienmckenna