Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

/launderrvictim package

Overview

Package launderrvictim is the /r/-DATA-DECLARED variant of the launder-game victim. Its Immutable type is declared HERE (in /r/), not in /p/launderpkg. This is the recommended inter-realm pattern: realms declare their own logic data types.

The hypothesis under test: with /r/-declared logic data, the Attack H/I/J/K/L laundering shapes are structurally impossible. Tests against this victim should all fail to mutate gImm.

Functions

ApplyHook

func ApplyHook(h func(*Immutable))

ApplyHook dispatches a caller-supplied callback on gImm. The callback's parameter type is /r/launderrvictim-declared, so /p/ packages can't supply this hook — only /r/ realms can.

Param

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.ApplyHook()"

Result

CallPDeferApply

func CallPDeferApply(fn func(*launderpkg.Immutable))

CallPDeferApply: multi-level defer chain. Victim invokes a /p/-method (DeferApply) on a victim-owned *launderpkg.Immutable; the /p/-method defers the attacker callback. Three frames at callback time: attacker.main → victim.CallPDeferApply → /p/.DeferApply (deferred fn dispatches here).

Param

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.CallPDeferApply()"

Result

CallThenPanic

func CallThenPanic(h func(*Immutable))

CallThenPanic invokes h synchronously and then panics. If h is attacker-supplied and writes via captured pointer, this is just a re-shape of ApplyHook.

Param

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.CallThenPanic()"

Result

ClearHooks

func ClearHooks()

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.ClearHooks()"

Result

DeferApplyHook

func DeferApplyHook(h func(*Immutable))

DeferApplyHook defers an ApplyHook call. The deferred ApplyHook itself runs borrow rule #1 to /r/launderrvictim, and inside the callback runs as borrow rule #1 of the attacker's realm — the standard known-open Apply pattern, but now triggered via defer.

Param

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.DeferApplyHook()"

Result

DeferCallback

func DeferCallback(h func(*Immutable))

DeferCallback installs h as a defer inside an /r/launderrvictim frame, then returns. h runs at frame pop. The question: at the time h is invoked, m.Realm has just been restored to caller's realm by PopFrameAndReturn — but wait, defers run BEFORE PopFrameAndReturn. So m.Realm should still be victim's. Does the deferred h then run under victim authority?

Param

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.DeferCallback()"

Result

GetBareArr

func GetBareArr() *[3]launderpkg.Bare

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.GetBareArr()"

Result

GetBareMap

func GetBareMap() map[string]launderpkg.Bare

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.GetBareMap()"

Result

GetBarePtrArr

func GetBarePtrArr() *[3]*launderpkg.Bare

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.GetBarePtrArr()"

Result

GetBarePtrMap

func GetBarePtrMap() map[string]*launderpkg.Bare

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.GetBarePtrMap()"

Result

GetBarePtrSlice

func GetBarePtrSlice() []*launderpkg.Bare

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.GetBarePtrSlice()"

Result

GetBareSlice

func GetBareSlice() []launderpkg.Bare

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.GetBareSlice()"

Result

MakeApplyTrampoline

func MakeApplyTrampoline() func(func(*Immutable))

MakeApplyTrampoline returns a closure that captures &gImm.Field indirectly: it captures *Immutable, and dispatches a caller-supplied callback fn on it. /r/-victim-declared body → borrow rule #1 → m.Realm = /r/-victim. If `fn` is /p/-declared (e.g. EvilWrite), it inherits victim authority. This is "victim returns a closure that's itself an Apply-style trampoline" — a packaged Apply.

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.MakeApplyTrampoline()"

Result

MakeWriterClosure

func MakeWriterClosure(value string) func()

MakeWriterClosure constructs a /r/-victim-declared closure that captures gImm and writes through it. The closure body is /r/-victim- declared, so borrow rule #1 fires at invocation → m.Realm = /r/-victim → write commits with victim authority. Returning this closure to an attacker is "consenting to write" by the victim.

Param

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.MakeWriterClosure()"

Result

PanicAfterPushDefer

func PanicAfterPushDefer(h func(*Immutable))

PanicAfterPushDefer pushes a defer and then panics, so the defer runs as part of panic unwinding. Tests that m.Realm is correctly borrowed when the defer body invokes a foreign function.

Param

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.PanicAfterPushDefer()"

Result

ReadBareArr0

func ReadBareArr0() string

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.ReadBareArr0()"

Result

ReadBareEmbed

func ReadBareEmbed() string

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.ReadBareEmbed()"

Result

ReadBareMapA

func ReadBareMapA() string

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.ReadBareMapA()"

Result

ReadBarePtr

func ReadBarePtr() string

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.ReadBarePtr()"

Result

ReadBarePtrArr0

func ReadBarePtrArr0() string

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.ReadBarePtrArr0()"

Result

ReadBarePtrMapA

func ReadBarePtrMapA() string

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.ReadBarePtrMapA()"

Result

ReadBarePtrSlice0

func ReadBarePtrSlice0() string

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.ReadBarePtrSlice0()"

Result

ReadBareSlice0

func ReadBareSlice0() string

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.ReadBareSlice0()"

Result

ReadBareSlice0Then1

func ReadBareSlice0Then1() string

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.ReadBareSlice0Then1()"

Result

ReadBareVal

func ReadBareVal() string

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.ReadBareVal()"

Result

ReadEmbed

func ReadEmbed() string

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.ReadEmbed()"

Result

ReadImm

func ReadImm() string

ReadImm reads the current field for after-attack verification.

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.ReadImm()"

Result

ReadPtr

func ReadPtr() string

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.ReadPtr()"

Result

ReadVal

func ReadVal() string

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.ReadVal()"

Result

RecoverAndRetry

func RecoverAndRetry(h func(*Immutable)) (recovered any)

RecoverAndRetry: inside a victim method, defer a recover, write something to gImm, then panic. After the recover, the function returns normally. Tests that internal panic/recover doesn't leak state.

Param

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.RecoverAndRetry()"

Result

RegisterHook

func RegisterHook(h ImmHook)

Param

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.RegisterHook()"

Result

RegisterPlainHook

func RegisterPlainHook(h PlainHook)

Param

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.RegisterPlainHook()"

Result

RunHooks

func RunHooks()

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.RunHooks()"

Result

RunPlainHooks

func RunPlainHooks()

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.RunPlainHooks()"

Result

UseAnyMutator

func UseAnyMutator(m launderpkg.AnyMutator)

UseAnyMutator boxes gImm as any and dispatches a /p/-declared AnyMutator. This is the dangerous shape from Attack L: victim boxes its own /r/-declared data through a /p/-defined interface that the attacker can implement.

Param

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.UseAnyMutator()"

Result

GetImm

func GetImm() *Immutable

GetImm hands out a pointer to gImm. Standard "victim exposes a pointer to its state" antipattern — but with /r/-declared data, the attacker should still be unable to write through it.

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.GetImm()"

Result

GetWithBareEmbed

func GetWithBareEmbed() *WithBareEmbed

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.GetWithBareEmbed()"

Result

GetWithBarePtr

func GetWithBarePtr() *WithBarePtr

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.GetWithBarePtr()"

Result

GetWithBareVal

func GetWithBareVal() *WithBareVal

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.GetWithBareVal()"

Result

GetWithEmbed

func GetWithEmbed() *WithEmbed

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.GetWithEmbed()"

Result

GetWithPtr

func GetWithPtr() *WithPtr

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.GetWithPtr()"

Result

GetWithVal

func GetWithVal() *WithVal

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/tests/vm/launderrvictim.GetWithVal()"

Result