Skip to content

Is it safe to use metering to run untrusted guest code? #3067

Answered by jcaesar
kvinwang asked this question in Q&A
Discussion options

You must be logged in to vote

It shouldn't be possible for the guest to bypass the metering restrictions:

Isn't the wasmer_metering_remaining_points stored in the instance memory?

It is not. WASM linear memory is separated from the locals on the call stack and the globals. (Besides security, this also helps optimization.)

I found that the metering achieves this feature by injecting a global variable wasmer_metering_remaining_points to track the gas.

To be overly accurate: It inserts a new global. This global doesn't have a name, only an index, and it's always a new global that the module doesn't otherwise have access to. (Shouldn't, at least. I haven't tried what happens if you try to access a global index once pa…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@kvinwang
Comment options

Answer selected by kvinwang
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants