Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lack of escaping on some pages can lead to XSS exposure #3549

Closed
ddb4github opened this issue May 10, 2020 · 27 comments
Closed

Lack of escaping on some pages can lead to XSS exposure #3549

ddb4github opened this issue May 10, 2020 · 27 comments
Labels
bug Undesired behaviour resolved A fixed issue SECURITY A security issue reported through CVE
Milestone

Comments

@ddb4github
Copy link
Contributor

ddb4github commented May 10, 2020

Describe the bug

Several XSS Vulnerabilities during XSS testing

To Reproduce

Case#1

  1. Go to 'Reporting(reports_admin.php)'
  2. Create/Modify a report
  3. Add a 'Text' item with Fixed Text <script>alert('test CVE');</script>
  4. Click save, and then return to Item list
  5. See error, popup alert('test CVE') as below
    image
  6. Click 'Preview' tab
  7. See error again.

Case#2

  1. Go to 'Console -> Data Collection -> Data Queries'
  2. Select a data query, and click name to edit it
  3. Click name of one of Associated Graph Templates
  4. Modify name to <script>alert('test CVE');</script>
  5. Click Save button, then click Return button
  6. Click x icon of row right for the modified one
  7. See error, popup alert('test CVE') as below
    image

Case#3

data_input.php, delete,click a output/input field with <script>alert('test CVE');</script>

Case#4

graph_templates.php add graph items with a color named <script>alert('test CVE');</script>

Case#5

  1. Go to 'Console -> Management`
  2. Add a XSS Site with name <script>alert('SiteCore');</script>
  3. Add a XSS Device with name: <script>alert('hostname');</script>, description: <script>alert('hostdesc');</script>
  4. Access any 'Console -> Management -> Trees`
  5. Click any one of tree name
  6. See error, popup twice alert('SiteCore'), alert('hostdesc'), alert('hostname').

Case#6

  1. Go to 'Console -> Management -> Trees`
  2. Crate a tree with name <script>alert('tree');</script>
  3. Access 'Console -> Management -> Graphs`
  4. Select any one of graph
  5. Select Action Place on a Tree <script>alert('tree');</script>
  6. Click Go
  7. See error, popup alert('tree')

Case#7

  1. Edit a graph template, fill name with <script>alert('gtemplatename');</script>
  2. Edit or create a report with name <script>alert('rptname');</script>
  3. Access Graphs --> List/Tree/Preview mode
  4. See error, tree/preview will popup alert('gtemplatename') only. And list mode will popup a extra alert('rptname')

Case#8

  1. Edit or create a graph template, fill name with <script>alert('gtemplatename');</script>
  2. Associate above graph template to a device
  3. Edit above device
  4. Click hyperlink Create Graphs for this Device
  5. Select above graph template in list
  6. Click "Create" button
  7. See error

Desktop (please complete the following information)

  • OS: Windows 10
  • Browser: Firefox
  • Version: 68.8 ESR
@ddb4github ddb4github added bug Undesired behaviour unverified Some days we don't have a clue labels May 10, 2020
@TheWitness
Copy link
Member

Jing, can you request a CVE#?

@TheWitness
Copy link
Member

Case #2 is not repeatable in 1.2.12.

@TheWitness
Copy link
Member

Okay, was able to verify issue #2, but issue #5 and #6 you need to provide additional details.

TheWitness added a commit that referenced this issue May 12, 2020
Several XSS Vulnerabilities
@TheWitness TheWitness added resolved A fixed issue and removed unverified Some days we don't have a clue labels May 12, 2020
@TheWitness TheWitness added this to the 1.2.13 milestone May 12, 2020
@ddb4github
Copy link
Contributor Author

Okay, was able to verify issue #2, but issue #5 and #6 you need to provide additional details.

Updated Case#5 and Case#6 for detail steps

@ddb4github
Copy link
Contributor Author

Jing, can you request a CVE#?

Just request, to be reviewed

@netniV
Copy link
Member

netniV commented May 12, 2020

Thanks @ddb4github! When I first started seeing these CVE's, it was upsetting as no one likes holes in their code, but at the same time we are very grateful that people are using the product and testing it thoroughly to help find these things 👍

Keep up the good work

TheWitness added a commit that referenced this issue May 14, 2020
Several XSS Vulnerabilities.  This resolves Case 6
TheWitness added a commit that referenced this issue May 14, 2020
Several XSS Vulnerabilities. This resolves Case 6
@TheWitness
Copy link
Member

Okay, all resolved. Thanks Jing.

@ddb4github
Copy link
Contributor Author

append Case7,8 to Issue Desc area

@yingbaiibm
Copy link

Append more cases

Case #9 data_sources.php page with popup exist

  1. Add a device with name <script>alert(1);</script>
  2. Create graph for the device
  3. Go to Data Sources page, click the data source with name <script>alert(1);</script>, pop up exist
    Screen Shot 2020-05-20 at 3 19 05 PM

Case #10 notify_lists.php with popup exist

  1. add a notification
  2. go to device page, popup exist due to there is device name as <script>alert(1);</script>
    Screen Shot 2020-05-20 at 3 21 16 PM

Case #11 automation_graph_rules.php popup exist on page

  1. Go to automation - Graph Rules page
  2. Add a rule with name and data query as <script>alert(1);</script> and save it.
  3. Click Graph Rules page again, popup exist.
    Screen Shot 2020-05-20 at 3 24 43 PM

Case #12 data_debug.php, edit a datasource with script has popup exist

  1. Go to TroubleShooting - Data Sources page
  2. Click a datasource name like <script>alert(1);</script>, pop up exist
    Screen Shot 2020-05-20 at 3 27 18 PM

@yingbaiibm
Copy link

### Case #13 reports_admin.php, add an item with script, click send now, pop up exist

  1. add report name like <script>alert(1);</script>
  2. Click the report
  3. Click send report, popup windows exist
    Screen Shot 2020-05-20 at 3 41 46 PM
    Screen Shot 2020-05-20 at 3 41 56 PM

### Case #14 click a tree named with script has popup

  1. Create a tree name like <script>alert(1);</script>
  2. publish the tree
  3. Go to graph page, click the tree name, popup exist
    Screen Shot 2020-05-20 at 3 47 53 PM

### Case #3 data_input.php, delete,click a output/input field with script --still failed with the fix
Screen Shot 2020-05-20 at 3 51 27 PM

### Case #4 graph_templates.php add graph items with a color named --failed with the fix

  1. Go to Present - Colors
  2. Add a color named like <script>alert(1);</script>
  3. Go to Template -Graph page
  4. Add a graph template
  5. Click add graph item, popup exist
    Screen Shot 2020-05-20 at 3 56 29 PM
    Screen Shot 2020-05-20 at 3 58 30 PM

@netniV
Copy link
Member

netniV commented May 20, 2020

Case #9 seems to be directly related to using drop_callback, as when you change the field to a textbox, the XSS doesn't exist.

Case #10 is specific to Thold so should be opened against that repo.

Case #11 is due to the Data Query drop down not being escaped.

Case #12 is due to the title not being escaped on the Were we able to convert the title? line.

Case #13 is due to the title not being escaped in the success/fail messages.

Case #14 is something i was unable to reproduce.

netniV added a commit that referenced this issue May 20, 2020
@netniV
Copy link
Member

netniV commented May 21, 2020

I have sorted 11 through 13, the rest are unresolved or unconfirmed.

@netniV netniV added SECURITY A security issue reported through CVE and removed resolved A fixed issue labels May 21, 2020
TheWitness added a commit that referenced this issue May 21, 2020
Several XSS Vulnerabilities
@TheWitness
Copy link
Member

I've fixed a few more of these. I guess we need to hit a reset button. @yingbaiibm, can you summarize what is still outstanding?

@yingbaiibm
Copy link

@TheWitness ok, I will check and summarize the status after we merge the new fix.

@yingbaiibm
Copy link

@TheWitness Test using latest cacti code, make a summray like below.
passed retest 10 cases, failed 4 cases, added 5 new cases. see details like below

@yingbaiibm
Copy link

passed case: 1, 2, 5, 6, 8, 10, 11, 12, 13, 14

Failed case 3, 4, 7, 9

Case3: click/delete a data output field has popup exist
case3

Case4: graph_templates.php add graph items with a color named
- go to present-color, add a color named with <script>alert('pcolor');</script>
- go to template graph, add a graph, add a graph item, popup exist
case4-1
Case4-2
case4-3

case7 go to graphs - list view mode, popup exist for reporting with name <script>alert('xxx');</script>
- Go to Reporting page, add a report name with <script>alert('reporting');</script>
- Go to Graphs - list view mode, popup of reporting exist
case7-1
case7-2

Case9 data_sources.php page with popup exist

New founded issue

Case#15 place device on a tree named with <script>alert('tree');</script> has popup exist
Case15

Case#16 create graph for a device has popup exist due to data query with script
- create a data query with name <script>alert('data_query');</script>
- Go to device page, add the data_query to the device
- Click create graphs for this device, popup exist
case16-1
case16-2
case16-3

Case#17 go to create graph page, popup exist
- create a data query with name <script>alert('data_query');</script>
- Go to device page, add the data_query to the device
- Go to Create - New graphs page, popup for data_query exist
case17

Case#18 create graph for a device has popup exist for color with script
- go to present-color, add a color named with <script>alert('pcolor');</script>
- Create a graph for device, choose Cisco- CPU Usage Graph template
- Click create, popup for pcolor exist
case18-1
case18-2

Case#19 go to graphs - preview mode has popup for graph name with script
Case19-1
Case19-2

TheWitness added a commit that referenced this issue May 30, 2020
Addressing remaining cases.
@TheWitness
Copy link
Member

Okay. Should be all resolved now.

@TheWitness TheWitness added the resolved A fixed issue label Jun 7, 2020
@netniV
Copy link
Member

netniV commented Jun 7, 2020

@ddb4github and @yingbaiibm can you confirm?

@yingbaiibm
Copy link

@TheWitness @netniV retest using latest code, 2 cases still have problem.

passed 4, 7, 9, 15, 16, 17, 18,

Failed 3, 19

Case#3, click a data output field has popup exist
Screen Shot 2020-06-08 at 2 02 43 PM
Screen Shot 2020-06-08 at 2 03 11 PM

page source code:
Screen Shot 2020-06-08 at 2 13 32 PM

Case#19 Go to graph list view/preview mode has popup exist
Screen Shot 2020-06-08 at 2 08 36 PM
Screen Shot 2020-06-08 at 2 06 31 PM
Screen Shot 2020-06-08 at 2 07 48 PM

@netniV
Copy link
Member

netniV commented Jun 8, 2020

Thanks for the feedback, we will look into it again.

@netniV netniV reopened this Jun 8, 2020
netniV added a commit that referenced this issue Jun 8, 2020
@netniV
Copy link
Member

netniV commented Jun 8, 2020

I believe that these two should be resolved now. Can you retest for me? Thank you so much for your time and patience.

@yingbaiibm
Copy link

@netniV test using your new fix. passed for data_input case.
For graph -preview mode, still has popup exist. please have a check.

@netniV
Copy link
Member

netniV commented Jun 8, 2020

I tried to reproduce it and the with my fix I seemed to no longer have the error. Can you give the page/mode you are using?

@ddb4github
Copy link
Contributor Author

ddb4github commented Jun 8, 2020

I tried to reproduce it and the with my fix I seemed to no longer have the error. Can you give the page/mode you are using?

Under Preview mode, 'alert' come from Template filter that is generated by function html_graph_preview_filter
image

ddb4github pushed a commit to ddb4github/cacti that referenced this issue Jun 8, 2020
netniV pushed a commit that referenced this issue Jun 9, 2020
Co-authored-by: Jing Chen <three_chenjing@sohu.com>
@netniV
Copy link
Member

netniV commented Jun 9, 2020

Thanks for the PR. Saves me doing the same thing. I think I fixed it under somewhere else.

@TheWitness
Copy link
Member

Okay, looks like this is good then. Stored XSS makes peoples lives more interesting I guess.

TheWitness added a commit that referenced this issue Jun 13, 2020
Several XSS Vulnerabilities
@TheWitness
Copy link
Member

Found one more in lib/import.php.

@netniV netniV changed the title Several XSS Vulnerabilities Lack of escaping on some pages can lead to XSS exposure Jul 12, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Oct 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Undesired behaviour resolved A fixed issue SECURITY A security issue reported through CVE
Projects
None yet
Development

No branches or pull requests

4 participants