8000 Access Control Bypass Vulnerability when forwarding or including via RequestDispatcher · Issue #130 · hdiv/hdiv · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
< 8000 a href="#start-of-content" data-skip-target-assigned="false" class="px-2 py-4 color-bg-accent-emphasis color-fg-on-emphasis show-on-focus js-skip-to-content">Skip to content
Access Control Bypass Vulnerability when forwarding or including via RequestDispatcher #130
Open
@KingBridgeSS

Description

@KingBridgeSS

HDIV uses org.hdiv.filter.ValidatorFilter to handle url access control. And the class extends org.springframework.web.filter.OncePerRequestFilter, which aims to guarantee a single execution per request dispatch. So if a request is forwarded or included, this filter will NOT do filter, which may lead to access control bypass.

Assume we have the hdiv config below (in hdiv-config.xml). Note that it means to block all request url excluding / or /forward

<hdiv:config excludedExtensions="css,png">
    <hdiv:startPages method="get">/</hdiv:startPages>
    <hdiv:startPages method="get">/forward</hdiv:startPages>
    <hdiv:
6472
startParameters>_method</hdiv:startParameters>
</hdiv:config>

and the controller

package org.springframework.samples.petclinic.web;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller

public class ForwardContrller {
    @RequestMapping(method = RequestMethod.GET,value="/secret")
    @ResponseBody
    public String secret(){
        return "this is my secret";
    }
    @RequestMapping(method = RequestMethod.GET,value="/forward")
    public String forward(){
        return "forward:/secret";
    }
}

Now visit /secret, and we see that it's unauthorized.

image-20221109234228633

visit /forward , it's redirected to the unauthorized page.

image-20221109234547860

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0