微服务CodeQL越权查询demo
2023-2-10 19:10:36 Author: xsser的博客(查看原文) 阅读量:3 收藏

Java代码

@RequestMapping(value = "/testRequest",method = RequestMethod.GET)
public ModelAndView selectUser(int id) throws IoException(
Long userId = Long.parseLong(string.valueOf(id));
User user = this.userService.selectUser(userId);
ModelAndView mv = new ModelAndView() ;
string name = user.getUsername();
String email = user.getEmail();
mv.addobject("name", name);
mv.addobject("email",email);
return mv;

CodeQL代码

from RequestMapping rmapping, Method m, ModelAndView mv, Call c, UserService us, DataFlow df1, DataFlow df2
where rmapping.value = "/testRequest" and
rmapping.method = RequestMethod.GET and
rmapping.declaringType = m.declaringType and
m.hasAnnotation(rmapping) and
c.target = m and
c.returnValue = mv and
df1.to = c and
df1.from = df2.to and
df2.fromMethod = us.selectUser and
df1.from.kind = "PARAMETER" and
df1.from.name = "id"
select c, "越权查询"


文章来源: http://mp.weixin.qq.com/s?__biz=MzA4NzA5OTYzNw==&mid=2247484266&idx=1&sn=36a9e05fb9b7c52ef35275ec77612d7d&chksm=903fd2f0a7485be62612bf4f6c77c1a397b69e36c145bf51edda5751133cf7076d2674b62f0a#rd
如有侵权请联系:admin#unsafe.sh