CC3

0x01 Preface

前面CC1和CC6的sink都在InvokerTransformer上,若WAF直接禁用了该类,是否就无法突破了呢?Introducing~ com.sun.org.apache.xalan.internal.xsltc.trax.TrAXFilter

public TrAXFilter(Templates templates)  throws
    TransformerConfigurationException
{
    _templates = templates;
    _transformer = (TransformerImpl) templates.newTransformer();
    _transformerHandler = new TransformerHandlerImpl(_transformer);
    _useServicesMechanism = _transformer.useServicesMechnism();
}

该类构造方法中调用了(TransformerImpl) templates.newTransformer()

TransformerImpl在加载字节码那提过,newTransformer最后能调用到defineClass()加载恶意字节码。

但是目前看来如果没有InvokerTransfomerTrAXFilter的构造方法也无法调用

这里要用到新的Transformer实现类InstantiateTransformer,看看它的transform,它的作用就是调用构造函数,返回类实例。

public Object transform(Object input) {
    //....
    Constructor con = ((Class) input).getConstructor(iParamTypes);
    return con.newInstance(iArgs);
    //....
}

0x02 Weave POC

使用javassist来获取字节码

将CC6改造成CC3模样:

Last updated

Was this helpful?