🔍 CVE-2024-49998

4.7
CVSS Score
MEDIUM
2024-10-21
2026-10-15 01:19
✅ 완료

🇰🇷 한글 설명

Linux 커널의 DSA(Distributed Switch Architecture) 네트워크 드라이버에서 셧다운 시 발생하는 레이스 컨디션 취약점입니다. lan9303 드라이버의 PHY 상태 머신이 종료되지 않거나, 패킷 수신 처리 중에 포인터가 NULL로 설정되어 Null Pointer Dereference(NPD)가 발생할 수 있습니다.

💡 쉬운 설명

컴퓨터를 끌 때 네트워크 장치가 제대로 정리되지 않아 시스템이 갑자기 멈추거나 오류가 발생할 수 있는 문제입니다. 장치가 꺼지는 도중에 데이터가 들어오면 잘못된 메모리 주소를 참조하게 되어 문제가 생깁니다.

🇺🇸 원문 (English)

In the Linux kernel, the following vulnerability has been resolved: net: dsa: improve shutdown sequence Alexander Sverdlin presents 2 problems during shutdown with the lan9303 driver. One is specific to lan9303 and the other just happens to reproduce there. The first problem is that lan9303 is unique among DSA drivers in that it calls dev_get_drvdata() at "arbitrary runtime" (not probe, not shutdown, not remove): phy_state_machine() -> ... -> dsa_user_phy_read() -> ds->ops->phy_read() -> lan9303_phy_read() -> chip->ops->phy_read() -> lan9303_mdio_phy_read() -> dev_get_drvdata() But we never stop the phy_state_machine(), so it may continue to run after dsa_switch_shutdown(). Our common pattern in all DSA drivers is to set drvdata to NULL to suppress the remove() method that may come afterwards. But in this case it will result in an NPD. The second problem is that the way in which we set dp->conduit->dsa_ptr = NULL; is concurrent with receive packet processing. dsa_switch_rcv() checks once whether dev->dsa_ptr is NULL, but afterwards, rather than continuing to use that non-NULL value, dev->dsa_ptr is dereferenced again and again without NULL checks: dsa_conduit_find_user() and many other places. In between dereferences, there is no locking to ensure that what was valid once continues to be valid. Both problems have the common aspect that closing the conduit interface solves them. In the first case, dev_close(conduit) triggers the NETDEV_GOING_DOWN event in dsa_user_netdevice_event() which closes user ports as well. dsa_port_disable_rt() calls phylink_stop(), which synchronously stops the phylink state machine, and ds->ops->phy_read() will thus no longer call into the driver after this point. In the second case, dev_close(conduit) should do this, as per Documentation/networking/driver.rst: | Quiescence | ---------- | | After the ndo_stop routine has been called, the hardware must | not receive or transmit any data. All in flight packets must | be aborted. If necessary, poll or wait for completion of | any reset commands. So it should be sufficient to ensure that later, when we zeroize conduit->dsa_ptr, there will be no concurrent dsa_switch_rcv() call on this conduit. The addition of the netif_device_detach() function is to ensure that ioctls, rtnetlinks and ethtool requests on the user ports no longer propagate down to the driver - we're no longer prepared to handle them. The race condition actually did not exist when commit 0650bf52b31f ("net: dsa: be compatible with masters which unregister on shutdown") first introduced dsa_switch_shutdown(). It was created later, when we stopped unregistering the user interfaces from a bad spot, and we just replaced that sequence with a racy zeroization of conduit->dsa_ptr (one which doesn't ensure that the interfaces aren't up).

📍 영향받는 시스템

Linux Kernel (DSA 및 lan9303 드라이버를 사용하는 시스템)

⚔️ 공격 벡터

시스템 종료 또는 네트워크 인터페이스 해제 시 발생하는 레이스 컨디션을 이용한 로컬 서비스 거부(DoS)

🛡️ 대응 방법

Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 dsa_switch_shutdown() 및 netif_device_detach() 로직을 반영해야 합니다.

🔧 검증 코드

출력된 커널 버전을 확인하여 해당 취약점이 수정된 패치 버전 이후인지 확인합니다.

Shell / Script
uname -r

📊 CVSS Vector String

CVSS Vector
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H

💻 영향받는 소프트웨어

Linux Kernel