
UserTransaction을 반복적으로 사용할 때 JBoss 클라이언트의 메모리 누수를 시연하며, CVE-2022-0853에 대한 PoC 및 분석을 포함합니다.
jboss 클라이언트 측에서 UserTransaction을 반복적으로 사용할 때 발생하는 메모리 누수입니다.
예를 들어:
private void testTransaction() throws Exception {
for(int i=1; i< 500000; i++) {
System.out.println("Starting process " + i);
// get the UserTransaction and EJB Proxy
Context ctx = getInitialContext(host, port, username, password);
UserTransaction tx = getUserTransaction(ctx);
ControllerRemote cr = (ControllerRemote)
ctx.lookup("Controller/Controller" + "!com.test.usertransaction.ControllerRemote");
try {
tx.begin();
}
catch(Exception ex1) {
ex1.printStackTrace();
}
//System.out.println("user transaction started");
cr.mainCall();
try {
tx.commit();;
}
catch(Exception ex1) {
ex1.printStackTrace();
throw ex1;
}
//System.out.println("commited user transaction");
if(ctx != null)
ctx.close();
}
}
트랜잭션은 EAP 7.3에 배포된 EJB에서 원격 클라이언트에 의해 실행됩니다. 트랜잭션은 50000회 반복됩니다. 반복이 끝나면 메모리 누수가 관찰됩니다. 32%의 메모리가 org.wildfly.transaction.client.provider.remoting.TransactionClientChannel에 의해 점유됩니다.