[
https://issues.apache.org/jira/browse/SHIRO-582?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17019017#comment-17019017
]
Benjamin Marwell commented on SHIRO-582:
----------------------------------------
Hello [~chris2m],
I know it is an old issue, but I was not able to reproduce it. Could you
provide a test case if it is still valid?
> NullPointerException in AntPathMatcher
> --------------------------------------
>
> Key: SHIRO-582
> URL: https://issues.apache.org/jira/browse/SHIRO-582
> Project: Shiro
> Issue Type: Bug
> Components: Authorization (access control)
> Affects Versions: 1.3.0
> Reporter: Christian Thum
> Priority: Major
>
> {{WebUtils.getRequestUri}} uses the {{normalize}} method to canonicalize the
> request URI. During an automated pentest, we found that a request to the
> following URL will cause a NPE:
> {{curl --path-as-is
> "http://127.0.0.1/\../\../\../\../\../\../Server4/admin-serv/config/adm.conf"}}
> The request will cause the path parameter of the `doMatch`method in
> org.apache.shiro.util.AntPathMatcher to be null. Executing the line
> {quote}
> {{ if (path.startsWith(this.pathSeparator) !=
> pattern.startsWith(this.pathSeparator)) }} will throw the NPE.
> {quote}
> This could be handled by adjusting the {{normalize}} method or null checking
> the path in the {{doMatch}} method.
> *Stacktrace*
> {quote}
> java.lang.NullPointerException
> at org.apache.shiro.util.AntPathMatcher.doMatch(AntPathMatcher.java:109)
> at org.apache.shiro.util.AntPathMatcher.match(AntPathMatcher.java:90)
> at org.apache.shiro.util.AntPathMatcher.matches(AntPathMatcher.java:86)
> at
> org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver.pathMatches(PathMatchingFilterChainResolver.java:135)
> at
> org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver.getChain(PathMatchingFilterChainResolver.java:106)
> at
> org.apache.shiro.web.servlet.AbstractShiroFilter.getExecutionChain(AbstractShiroFilter.java:415)
> at
> org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:448)
> {quote}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)