Javascript login form includes unencoded parameters
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mahara |
Fix Released
|
Critical
|
Son Nguyen |
Bug Description
Discovered by Emanuel Bronshtein, present in all versions.
parameters from URI are passed to javascript innerHTML without proper encoding, it possible to use some encoding inside javascript strings, as:
\x22\x3E = ">
\u0022\u003E = ">
by using this encoding it possible to trigger XSS.
Payload:
"><h1>XSS</h1><img src=9 onerror=
XSS Example:
http://
http://
---
When a logged-out user tries to access a page that requires them to be logged in, a login form is generated, all get parameters are added to the form's action attribute & all post parameters are added as hidden elements inside the form. The login form is then inserted into the dom using innerHTML. This is for convenience, to let the user continue whatever it was they were trying to do if, for example, their session expired. I think it may be enough to url encode each query parameter name & value in the action url before generating the form, but haven't tested this yet.
Changed in mahara: | |
assignee: | nobody → Son Nguyen (ngson2000) |
status: | Confirmed → In Progress |
security vulnerability: | no → yes |
This appears to fix it for me, but I'd appreciate some more opinions.
I think we also need to have a good look through all the innerHTML calls, because this is not necessarily restricted to the login form. I think 'Pieform' forms with jsform = true are doing the right thing though.