Skip to content

Pyth test program mutably casts unchecked account data without owner/type validation #1

Description

@87d341f7600a4bb6

Bug Type

Missing owner/type checks

Vulnerable Lines

  • tests/pyth/programs/pyth/src/lib.rs:23-27
  • tests/pyth/programs/pyth/src/lib.rs:31-35
  • tests/pyth/programs/pyth/src/pc.rs:101-109

Root Cause

SetPrice.price is a mutable raw AccountInfo. Price::load borrows account data mutably and casts it into a Price layout without checking owner, account size, discriminator/magic value, or type.

Exploit Way

A caller can provide any writable account with sufficiently shaped data. The handler will reinterpret the bytes as a price account and mutate agg.price; malformed data can also panic via unwrap().

Impact

Unchecked account data can be corrupted or cause instruction failure/DoS in this test program.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions