Wire 7.1.0: Uncaught IllegalStateException on Incompatible Wire Types for Message Fields
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
Hướng nghiên cứu
Start by reading RuntimeMessageAdapter.decode() and ByteArrayProtoReader32.beginMessage() in the affected Wire runtime path. Reproduce with the provided schema and 8D0100000000 input, then check how FIXED32 and FIXED64 tags are dispatched for a message field. Done means incompatible wire types produce a controlled parsing result or are handled as unknown fields, with regression coverage for both cases.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Square Wire 7.1.0 contains an unchecked exception issue when decoding Protobuf message fields with incompatible wire types.
A crafted 6-byte Protobuf input can trigger an IllegalStateException in ByteArrayProtoReader32.beginMessage() through the schema-based RuntimeMessageAdapter decoding path.
Applications that process untrusted Protobuf messages may experience unexpected processing failures if the exception is not handled.
Affected Components
wire-runtime-jvm:7.1.0wire-schema-jvm:7.1.0RuntimeMessageAdapter.decode()ByteArrayProtoReader32.beginMessage()
Steps to Reproduce
Example Protobuf schema:
syntax = "proto2";
message Child {}
message AllTypes {
optional Child child = 17;
}
Crafted input:
8D 01 00 00 00 00
The field tag identifies field 17 with wire type FIXED32, while the declared message field requires LENGTH_DELIMITED.
In the differential testing environment:
java -cp "$CP" demo.protobuf.ProtobufStack 8D0100000000
Actual Result
protobuf-java 4.36.2: ACCEPTED {}
Wire 7.1.0: IllegalStateException:
Unexpected call to beginMessage()
at ByteArrayProtoReader32.beginMessage()
at RuntimeMessageAdapter.decode()
Jackson Protobuf 2.22.4: JsonParseException
A corresponding FIXED64 input also triggers the exception.
Root Cause
RuntimeMessageAdapter.decode() dispatches to the message adapter without sufficiently validating the incoming field's wire type.
Consequently, ByteArrayProtoReader32.beginMessage() is called while the reader is in an incompatible state, triggering an unchecked IllegalStateException.
Security Impact
Malformed Protobuf messages can trigger an unchecked exception instead of a controlled parsing failure. Applications that only handle IOException may experience interrupted message processing.
The current proof of concept demonstrates a parsing failure; service-wide denial of service has not been established.
Suggested Fix
Validate incoming wire types before dispatching to field adapters. Incompatible encodings should be handled as unknown fields where appropriate, or rejected using a documented parsing exception.
- Ngôn ngữ chính
- Kotlin
- Star
- 4.4k
- Fork
- 635
- Merge trung bình
- 7 giờ 27 phút
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của square/wire
-
Moshi and Gson JSON adapters fail for messages with a map<bool, V> fieldCó thể đã có người làm @sebxt đã nhận 12 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
GrpcStreamingCall() factory's executeIn() hardcodes Dispatchers.IO instead of using an incoming scopeCó thể đã có người làm @oldergod đã nhận 199 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Wire 7.1.0: Incompatible LENGTH_DELIMITED Encoding Is Silently Accepted for Singular Scalar FieldsCó thể đã có người làm @oldergod đã nhận 1 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
-
Swift: clear a field's preserved unknown enum value from unknownFields when the field is mutatedĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 76/100
Issue tương tự
-
[Bug] Web Player: Misalignment in lyrics toolbar with format dropdown ('Auto') and download iconĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
kushagrasinghx/BitChord#1269 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[📚] migrating-to-v27: Android fails on Expo SDK 58 (Kotlin 2.2) — document the BoM 34.19.0 overrideĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
invertase/react-native-firebase#9418 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
react/react-native#59693 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Keep a caller-supplied `screen` entity instead of attaching the tracker’s current screenCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100