Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Wire 7.1.0: Uncaught IllegalStateException on Incompatible Wire Types for Message Fields

Đang mở
#3,737 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

@oldergod đang làm issue này rồi.

Từ ngày 29/10/2026.

  • #3739 của @oldergod — đang mở

Đá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
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
kotlin
Lĩnh vực
backend

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.0
  • wire-schema-jvm:7.1.0
  • RuntimeMessageAdapter.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

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của square/wire

Tất cả issue của square/wire

Issue tương tự

Thêm issue về Kotlin

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.