Is Your App Still Thinking About Your Ex-User?
A Kotlin Multiplatform app using the Voyager navigation library defined a tab as a singleton object, causing the same ViewModel instance to be reused across user sessions. An attacker who gains access to a device after a user logs out could see the previous user's data because the ViewModel was not cleared.
medium.com
Published on medium.com
Pull up a chair, let’s talk about a classic bug that we noticed in our KMM app. We were building a beautiful app for our cafe but things got messy when our cafe got busy.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the tab was declared as a Kotlin object (singleton), so the ViewModel associated with it was never destroyed and got reused for subsequent users.
Impact
A user who logs in after another user on the same device could see the previous user's data because the ViewModel was not cleared.
What the attacker needed
Same device used by two users; app uses Voyager with object tab
The fix
The tab should be changed from an object to a class and given a unique key so that a new ViewModel is created for each session.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
In some apps, a screen's data holder (called a ViewModel) can be accidentally kept alive forever if the screen is defined as a single shared instance (an object). When a new person logs in, the app may still show the old person's information because it never threw away the old data holder. This bug means that after someone logs out, the next person using the same device could see private data from the previous session.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.