[하루한줄] CVE-2025-32756: Fortinet 제품들의 API에서 발생한 ITW Stack Buffer Overflow 취약점으로 인한 Unauthenticated RCE

URL

Target

Version Affected Solution
FortiCamera 2.1 2.1.0 through 2.1.3 Upgrade to 2.1.4 or above
FortiCamera 2.0 2.0 all versions Migrate to a fixed release
FortiCamera 1.1 1.1 all versions Migrate to a fixed release
FortiMail 7.6 7.6.0 through 7.6.2 Upgrade to 7.6.3 or above
FortiMail 7.4 7.4.0 through 7.4.4 Upgrade to 7.4.5 or above
FortiMail 7.2 7.2.0 through 7.2.7 Upgrade to 7.2.8 or above
FortiMail 7.0 7.0.0 through 7.0.8 Upgrade to 7.0.9 or above
FortiNDR 7.6 7.6.0 Upgrade to 7.6.1 or above
FortiNDR 7.4 7.4.0 through 7.4.7 Upgrade to 7.4.8 or above
FortiNDR 7.2 7.2.0 through 7.2.4 Upgrade to 7.2.5 or above
FortiNDR 7.1 7.1 all versions Migrate to a fixed release
FortiNDR 7.0 7.0.0 through 7.0.6 Upgrade to 7.0.7 or above
FortiNDR 1.5 1.5 all versions Migrate to a fixed release
FortiNDR 1.4 1.4 all versions Migrate to a fixed release
FortiNDR 1.3 1.3 all versions Migrate to a fixed release
FortiNDR 1.2 1.2 all versions Migrate to a fixed release
FortiNDR 1.1 1.1 all versions Migrate to a fixed release
FortiRecorder 7.2 7.2.0 through 7.2.3 Upgrade to 7.2.4 or above
FortiRecorder 7.0 7.0.0 through 7.0.5 Upgrade to 7.0.6 or above
FortiRecorder 6.4 6.4.0 through 6.4.5 Upgrade to 6.4.6 or above
FortiVoice 7.2 7.2.0 Upgrade to 7.2.1 or above
FortiVoice 7.0 7.0.0 through 7.0.6 Upgrade to 7.0.7 or above
FortiVoice 6.4 6.4.0 through 6.4.10 Upgrade to 6.4.11 or above

배경지식

CVE-2025-32756는 admin.fe 엔드포인트에서 발생한 Stack Buffer Overflow 취약점으로 인증되지 않은 공격자가 원격으로 코드를 실행할 수 있으며 FortiVoice를 대상으로 실제 공격에 사용되었다고 합니다. 자세한 IoC는 아래 링크를 참조하세요.

취약점은 admin.fe 엔드포인트에 전달된 인자 중 AuthHash를 처리할 때 발생합니다.

size_t input_size;
size_t __size;
uchar *AuthHash;
uchar *Payload;
long output_buffer [2];
out_00 = (uchar *)malloc(__size);

iVar2 = __isoc99_sscanf(param_1,"Era=%1d&Payload=%m[^&]&AuthHash=%m[^&]&",&Era,&Payload, &AuthHash);

input_size = strlen((char *)AuthHash);
__size = strlen((char *)Payload);

iVar3 = EVP_DecodeUpdate(ctx,(uchar *)output_buffer,&output_size,AuthHash,(int)input_size);

iVar2 = EVP_DecodeUpdate(ctx,out_00,&local_94,Payload,iVar2);

AuthHash는 변수 이름처럼 해시 데이터가 저장되어 전송됩니다. AuthHash가 디코딩된 경과가 output_buffer라는 지역변수에 저장되며 크기는 16바이트 입니다. 따라서 디코딩된 결과가 16바이트 이상일 경우, Stack Buffer Overflow가 발생하게 됩니다.

패치는 다음과 같이 인풋의 사이즈가 0x1e보다 작은지 체크하는 방식으로 진행되었습니다.

size_t input_size;
size_t __size;
uchar *AuthHash;
uchar *Payload;
long output_buffer [2];
out_00 = (uchar *)malloc(__size);

iVar2 = __isoc99_sscanf(param_1,"Era=%1d&Payload=%m[^&]&AuthHash=%m[^&]&",&Era,&Payload, &AuthHash);

input_size = strlen((char *)AuthHash);
__size = strlen((char *)Payload);

input_size = strlen((char *)AuthHash);
if (input_size < 0x1e) {

iVar3 = EVP_DecodeUpdate(ctx,(uchar *)output_buffer,&output_size,AuthHash,(int)input_size);

iVar2 = EVP_DecodeUpdate(ctx,out_00,&local_94,Payload,iVar2);

Reference