Skip to content

Conversation

@vadorovsky
Copy link
Contributor

@vadorovsky vadorovsky commented Sep 27, 2023

Submitting too large inputs might be a potential DDoS attack vector. Before this change, hash_bytes_be was reversing all input byte slices before validating them (to convert them from big-endian to little-endian), so it was prone to an attack, where a malicious user could submit arrays just to DDoS the software using light-poseidon with heavy reversal operations.

Fix that by performing validation as the first operation on byte inputs.

Also, remove the fuzz-tests flag and run all tests by default. After this fix, the runtime of fuzz tests is fast. Its degradation is actually an indicator of performance issues or DDoS attack vectors.

Kudos to @samkim-crypto for finding the issue.

Ref: solana-labs/solana#33363

Submitting too large inputs might be a potential DDoS attack vector.
Before this change, `hash_bytes_be` was reversing all input byte
slices before validating them (to convert them from big-endian to
little-endian), so it was prone to an attack, where a malicious user
could submit arrays just to DDoS the software using light-poseidon
with heavy reversal operations.

Also, remove the `fuzz-tests` flag and run all tests by default. After
this fix, the runtime of fuzz tests is fast. Its degradation is
actually an indicator of performance issues or DDoS attack vectors.

Fix that by performing validation as the first operation on byte
inputs.

Kudos to @samkim-crypto for finding the issue.

Ref: solana-labs/solana#33363
@vadorovsky vadorovsky force-pushed the vadorovsky/check-modulus-bytes-be branch from 83b0354 to 2929884 Compare September 28, 2023 09:31
@ananas-block ananas-block merged commit 826cc16 into main Oct 29, 2023
@ananas-block ananas-block deleted the vadorovsky/check-modulus-bytes-be branch October 29, 2023 13:54
samkim-crypto pushed a commit to solana-labs/solana that referenced this pull request Nov 10, 2023
That new release contains an important change which prevents a
potential DDoS.

* Lightprotocol/light-poseidon#32

Invoking `from_bytes_be` function light-poseidon 0.1.1 inverts all
the inputs before performing a check whether their length exceeds
the modulus of the prime field. Therefore, it was prone to an
attack, where a mailicious user could submit long byte slices just
to DDoS the validator, being stuck on inverting large byte sequences.

The update and mentioned change fixes the same issue as #33363 aims
to address.

The new release contains also few other less important changes like:

* Lightprotocol/light-poseidon#37
* Lightprotocol/light-poseidon#38
* Lightprotocol/light-poseidon#39
mergify bot pushed a commit to solana-labs/solana that referenced this pull request Nov 28, 2023
That new release contains an important change which prevents a
potential DDoS.

* Lightprotocol/light-poseidon#32

Invoking `from_bytes_be` function light-poseidon 0.1.1 inverts all
the inputs before performing a check whether their length exceeds
the modulus of the prime field. Therefore, it was prone to an
attack, where a mailicious user could submit long byte slices just
to DDoS the validator, being stuck on inverting large byte sequences.

The update and mentioned change fixes the same issue as #33363 aims
to address.

The new release contains also few other less important changes like:

* Lightprotocol/light-poseidon#37
* Lightprotocol/light-poseidon#38
* Lightprotocol/light-poseidon#39

(cherry picked from commit 67f8daf)

# Conflicts:
#	Cargo.lock
#	Cargo.toml
#	programs/sbf/Cargo.lock
Lichtso pushed a commit to solana-labs/solana that referenced this pull request Nov 28, 2023
That new release contains an important change which prevents a
potential DDoS.

* Lightprotocol/light-poseidon#32

Invoking `from_bytes_be` function light-poseidon 0.1.1 inverts all
the inputs before performing a check whether their length exceeds
the modulus of the prime field. Therefore, it was prone to an
attack, where a mailicious user could submit long byte slices just
to DDoS the validator, being stuck on inverting large byte sequences.

The update and mentioned change fixes the same issue as #33363 aims
to address.

The new release contains also few other less important changes like:

* Lightprotocol/light-poseidon#37
* Lightprotocol/light-poseidon#38
* Lightprotocol/light-poseidon#39

(cherry picked from commit 67f8daf)
samkim-crypto pushed a commit to solana-labs/solana that referenced this pull request Dec 8, 2023
…4247)

chore: Update light-poseidon to 0.2.0 (#33923)

That new release contains an important change which prevents a
potential DDoS.

* Lightprotocol/light-poseidon#32

Invoking `from_bytes_be` function light-poseidon 0.1.1 inverts all
the inputs before performing a check whether their length exceeds
the modulus of the prime field. Therefore, it was prone to an
attack, where a mailicious user could submit long byte slices just
to DDoS the validator, being stuck on inverting large byte sequences.

The update and mentioned change fixes the same issue as #33363 aims
to address.

The new release contains also few other less important changes like:

* Lightprotocol/light-poseidon#37
* Lightprotocol/light-poseidon#38
* Lightprotocol/light-poseidon#39

(cherry picked from commit 67f8daf)

Co-authored-by: vadorovsky <[email protected]>
crossdev24 pushed a commit to crossdev24/solana that referenced this pull request Jun 24, 2024
That new release contains an important change which prevents a
potential DDoS.

* Lightprotocol/light-poseidon#32

Invoking `from_bytes_be` function light-poseidon 0.1.1 inverts all
the inputs before performing a check whether their length exceeds
the modulus of the prime field. Therefore, it was prone to an
attack, where a mailicious user could submit long byte slices just
to DDoS the validator, being stuck on inverting large byte sequences.

The update and mentioned change fixes the same issue as #33363 aims
to address.

The new release contains also few other less important changes like:

* Lightprotocol/light-poseidon#37
* Lightprotocol/light-poseidon#38
* Lightprotocol/light-poseidon#39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants