Modify ↓
      
#7912 closed defect (fixed)
Milestone etc. values for ticket query filters are not escaped
| Reported by: | Owned by: | Jonas Borgström | |
|---|---|---|---|
| Priority: | highest | Milestone: | 0.11.3 | 
| Component: | report system | Version: | 0.11.2.1 | 
| Severity: | normal | Keywords: | security | 
| Cc: | osimons | Branch: | |
| Release Notes: | |||
| API Changes: | |||
| Internal Changes: | |||
Description
Values that are placed into select boxes to filter queries are not escaped, meaning an XSS attack is possible.
How to reproduce
Create a milestone that has " characters in it, e.g:
'Hello "]}}; alert("test"); properties = {milestone: {options: ["'
Trac version: tested on 0.11.1 and 0.11.2.1
Attachments (0)
Change History (4)
comment:1 by , 17 years ago
| Keywords: | security added | 
|---|---|
| Milestone: | → 0.11.3 | 
| Priority: | normal → highest | 
comment:2 by , 17 years ago
| Cc: | added | 
|---|
comment:3 by , 17 years ago
| Resolution: | → fixed | 
|---|---|
| Status: | new → closed | 
comment:4 by , 17 years ago
| Owner: | set to | 
|---|
  Note:
 See   TracTickets
 for help on using tickets.
    


  
Thanks for the report. It seems we populate the various values into a JS inline script, and for some reason we enclose the option value in a set of
""quotes which basically nullifies the escape-by-default behavior.This diff fixes the issue, and as far as I can see custom query continues to work as expected. Could someone else please confirm the fix, and is this serious enough to warrant a security release? It only affects meta-data, that very seldom can be modified by regular users. However, no doubt risks could exist depending on the setup of individual Trac sites.
trac/ticket/templates/query.html
"$option"$sep