🇰🇷 한글 설명
Linux 커널의 hp-wmi-sensors 드라이버에서 fungible_show() 함수 호출 시 발생하는 Use-After-Free 취약점입니다. 센서 상태 업데이트 시 락(lock)이 해제된 후 데이터를 읽는 과정에서 경쟁 상태(Race Condition)가 발생하여 메모리 오류를 유발할 수 있습니다.
💡 쉬운 설명
센서의 상태 정보를 읽어오는 도중에 다른 프로세스가 해당 정보를 삭제하고 새로 만들면서 발생하는 충돌 문제입니다. 이로 인해 시스템이 불안정해지거나 예기치 않은 오류가 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
hwmon: (hp-wmi-sensors) Fix use-after-free in fungible_show()
nsensor->current_state is dynamically replaced as the sensor's state
changes. update_numeric_sensor_from_wobj() does this by freeing the
old string and installing a new one:
if (strcmp(trimmed, nsensor->current_state)) {
new_string = hp_wmi_strdup(dev, trimmed);
if (new_string) {
devm_kfree(dev, nsensor->current_state);
nsensor->current_state = new_string;
}
}
This function is only ever called from hp_wmi_update_info() while
state->lock is held, so the free-and-replace itself is properly
serialized against concurrent updates.
fungible_show(), however, reads the same pointer after the lock has
already been dropped:
err = hp_wmi_update_info(state, info);
if (err)
return err;
switch (prop) {
...
case HP_WMI_PROPERTY_CURRENT_STATE:
seq_printf(seqf, "%s\n", nsensor->current_state);
break;
hp_wmi_update_info() takes state->lock internally and releases it
before returning, so by the time fungible_show() dereferences
nsensor->current_state in seq_printf(), no lock is held. Two
processes reading a sensor's current_state debugfs entry at
overlapping times (or one reading it while another read of the same
sensor triggers a refresh) can race: one thread's seq_printf() can
be part-way through printing the string at the moment another
thread's call into update_numeric_sensor_from_wobj() frees it with
devm_kfree() and installs a new pointer, causing a use-after-free
read.
Take state->lock around the read in fungible_show() as well, so it
can never run concurrently with the free-and-replace in
update_numeric_sensor_from_wobj().
📍 영향받는 시스템
Linux kernel (hp-wmi-sensors 드라이버를 사용하는 시스템)
⚔️ 공격 벡터
동시에 여러 프로세스가 센서 상태 정보를 읽거나 업데이트를 시도하여 경쟁 상태를 유도함
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 fungible_show() 함수에 락(lock)을 적용함
🔧 검증 코드
출력된 커널 버전을 확인하여 해당 취약점이 해결된 패치 버전인지 확인합니다.