
Tinyproxy에서 발견된 심각한 use-after-free 취약점
우리는 테러 단체 하마스에 의해 인질로 잡힌 모든 시민의 안전한 귀환을 요구합니다. 모든 인질이 석방되어 안전하게 집으로 돌아올 때까지 우리는 쉬지 않을 것입니다. 여러분도 그들을 집으로 데려오는 데 도움을 줄 수 있습니다. https://stories.bringthemhomenow.net/
🚨 심각한 취약점 경고 🚨
🔍 CVE-2023-49606은 경량 HTTP/S 프록시 서버인 Tinyproxy에서 발견된 심각한 use-after-free 취약점입니다. 이 결함은 Tinyproxy 버전 1.11.1 및 1.10.0의 HTTP Connection 헤더 처리에 존재합니다. 이 취약점은 잠재적인 서비스 거부(DoS) 공격을 허용하며, 특정 상황에서는 원격 코드 실행(RCE)으로 이어질 수 있습니다.
📈 CVSS 점수: 9.8 (심각)
이 취약점은 HTTP 헤더를 처리할 때 메모리 관리가 부적절하여 발생합니다. http-message.c 소스 코드는 HTTP 헤더에 대한 메모리 할당, 재할당 및 해제 작업을 처리합니다. 문제는 메모리 재할당 후 해제된 메모리에 접근하는 상황에서 발생하며, 이는 올바르게 null 처리되지 않습니다.
다음은 http-message.c의 관련 코드 일부입니다:
/* Function to add headers to the HTTP message structure */
void http_message_add_headers(http_message_t *msg, const char **headers, unsigned int num_headers) {
const char **new_headers;
unsigned int i;
if (headers == NULL) {
return;
}
// Check if there is enough space, if not, reallocate
if (msg->headers.used + num_headers > msg->headers.total) {
new_headers = (const char **) safecalloc (msg->headers.total * 2, sizeof(char *));
if (new_headers == NULL) {
return; // Allocation failed, potential for use-after-free if not handled
}
// Copy existing headers to the new array
for (i = 0; i != msg->headers.used; ++i) {
new_headers[i] = msg->headers.strings[i];
}
safefree(msg->headers.strings); // Free old array
msg->headers.strings = new_headers; // Danger if old pointers are used post this point
msg->headers.total *= 2;
}
// Add new headers to the structure
for (i = 0; i != num_headers; ++i) {
msg->headers.strings[i + msg->headers.used] = headers[i];
}
msg->headers.used += num_headers;
}