frida-go icon indicating copy to clipboard operation
frida-go copied to clipboard

Spawn Gate missing type for refelections

Open bluuuk opened this issue 9 months ago • 1 comments

While trying to add Spawn Gating to gxpc in https://github.com/ReverseApple/gxpc/pull/25, I came across missing functionality in the current frida-go version:

	lock := sync.Mutex{}
	lock.Lock()

	dev.On("spawn-added", func(spawn *frida.Spawn) {
		logger.Infof("%d", spawn.PID())
		if spawn.Identifier() == spawnGate {
			procPid = spawn.PID()
			lock.Unlock()
		} else {
			logger.Infof("Ignore Spawn(pid=%d, identifier=%s)", spawn.PID(), spawn.Identifier())
		}
		spawn.Clean()
	})
	lock.Lock()

The doc says spawn_added but https://gist.github.com/pellaeon/3925b0fd2d8939e12b38325d16c0003b uses spawn-added - i tried both but this should by a typo?

When I open a app on my iPad, the gxpc crashes. I tried to debug the error and is is likely caused in the function below. It results into a crash as this function in unmarshall.go returns a string instead of raising a panic that messes up refelections later:

// GValueToGo is the function that is called upon unmarshalling glib values
// into go corresponding ones.
func GValueToGo(val *C.GValue) any {
	gt := C.get_gvalue_gtype(val)
	cgt := C.GoString(gt)

	f, ok := gTypeString[gTypeName(cgt)]
	if !ok {
		return fmt.Sprintf("%s type is not implemented, please file an issue", cgt)
	}

	return f(val)
}

bluuuk avatar Apr 14 '25 02:04 bluuuk

Hi @bluuuk, thank you for reporting this, I will take a look at it in the coming days.

NSEcho avatar Apr 15 '25 08:04 NSEcho