微服务CodeQL越权查询demo

admin 2023年2月12日13:52:19评论120 views字数 800阅读2分40秒阅读模式

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, "越权查询"


原文始发于微信公众号(xsser的博客):微服务CodeQL越权查询demo

免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2023年2月12日13:52:19
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   微服务CodeQL越权查询demohttps://cn-sec.com/archives/1548173.html
                  免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉.

发表评论

匿名网友 填写信息