有缺陷的访问控制
HijackSessionAssignment
在 HijackSessionAuthenticationProvider 类中,ID 的生成由以下代码控制:
private static long id = new Random().nextLong() & Long.MAX_VALUE;
// ...
private static final Supplier<String> GENERATE_SESSION_ID = () -> ++id + "-" + Instant.now().toEpochMilli();
- 使用 Random().nextLong() 生成初始随机数,并通过 & Long.MAX_VALUE 确保为正数
- 每次生成新 ID 时使用 ++id 递增
- 附加当前时间的毫秒数(Instant.now().toEpochMilli())
@Overridepublic Authentication authenticate(Authentication authentication) {if (authentication == null) {return AUTHENTICATION_SUPPLIER.get();}// 检查1:如果提供了ID且该ID在有效会话列表中if (StringUtils.isNotEmpty(authentication.getId())&& sessions.contains(authentication.getId())) {authentication.setAuthenticated(true);return authentication;}
// 检查2:如果ID为空则生成新IDif (StringUtils.isEmpty(authentication.getId())) {authentication.setId(GENERATE_SESSION_ID.get());}authorizedUserAutoLogin();// 25%概率自动授权新会话return authentication;}protected void authorizedUserAutoLogin() {if (!PROBABILITY_DOUBLE_PREDICATE.test(ThreadLocalRandom.current().nextDouble())) {Authentication authentication = AUTHENTICATION_SUPPLIER.get();authentication.setAuthenticated(true);addSession(authentication.getId());}}
总而言之,这道 题就是有百分之二十五的概率自动授权新对话,把它加入有效会话列表,而题目过关要求是输入的cookie值在有效会话列表中,所以根据会话id递增的规律,可以爆破解题。
先不设置cookie值,查看返回的cookie值
5307212479590026264-1750838353211
5307212479590026265-1750838369939
5307212479590026266-1750838383003
5307212479590026268-1750838396384
发现丢失了67号,所以以这个开始爆破
不安全的直接对象引用
直接对象引用是指应用程序使用客户端提供的输入参数来访问数据或对象的一种设计方式。
如使用GET方法的直接对象引用通常表现为以下形式:
https://some.company.tld/dor?id=12345
https://some.company.tld/images?img=12345
https://some.company.tld/dor/12345
IDORLogin
输入tom和cat就行
这里利用hashmap的方式存储数据
IDORDiffAttributes
抓包获取属性列就行
IDORViewOwnProfile
/IDOR/profile/{userId},userId可以由前面抓包的时候看到,也可以爆破
IDORViewOtherProfile
查看其他人的profile,根据id号爆破
源码就是直接匹配了388这个id号
Missing Function Level Access Control
功能级访问控制缺失
MissingFunctionACHiddenMenus
隐藏的菜单项
MissingFunctionACYourHash
访问上题得到的/access-control/users路由,并添加Content-Type: application/json,返回hash数据
源码就是比对Jerry的Userhash