shiro721 复现

适用版本:shiro大于1.2.24,小于1.4.42.在1.2.24中,shiro修复了秘钥硬编码在代码中的漏洞,然而并没有根本上去解决问题.
在shiro550中,秘钥是硬编码在代码中的.

public AbstractRememberMeManager() {
        this.serializer = new DefaultSerializer<PrincipalCollection>();
        this.cipherService = new AesCipherService();
        setCipherKey(DEFAULT_CIPHER_KEY_BYTES);
    }

而在shiro721中,秘钥是动态的去生成的.

public AbstractRememberMeManager() {
        this.serializer = new DefaultSerializer<PrincipalCollection>();
        AesCipherService cipherService = new AesCipherService();
        this.cipherService = cipherService;
        setCipherKey(cipherService.generateNewKey().getEncoded());
    }
    }

然而在这版本的shiro中,对于AES CBC的错误处理不当,因此可以通过padding oracle攻击去获取动态生成的秘钥.由于本人不懂密码,所以就不去调试了(调试了也看不出来有密码层面的洞).直接给出github上大佬的脚本paddingoracle.
直接使用现成的工具去打一下得了...
image

posted @ 2025-01-16 14:58  colorfullbz  阅读(76)  评论(0)    收藏  举报