<!-- XE-0677 · [VM/High] TOCTOU race in DevTargetManager.SpawnSession — shells survive lease teardown · testnet -->
*Markdown view of <https://bounty.xe.network/XE-0677>. The page is the record; this is the same page for reading.*

XE-0677 · Bounty

# \[VM/High\] TOCTOU race in DevTargetManager.SpawnSession — shells survive lease teardown

Closed · duplicate
—claimed High
web
filed 2026-11-05 11:28 UTC
by Ashev Ardiansyah

Verdict
:   Duplicate

Tier
:   —

Claimed
:   High

Area
:   —

Duplicate of
:   —

Tracked
:   —

Updated
:   2026-11-05 22:19 UTC

Told
:   2026-11-05 22:19 UTC

### Patches

None linked.

### History

- [10227](https://bounty.xe.network/log/10227) 2026-11-05 22:19 UTC reply.sent
- [10226](https://bounty.xe.network/log/10226) 2026-11-05 22:19 UTC proposal.adopted
- [10225](https://bounty.xe.network/log/10225) 2026-11-05 22:19 UTC proposal.adopted
- [10224](https://bounty.xe.network/log/10224) 2026-11-05 22:19 UTC ticket.status new → closed
- [10223](https://bounty.xe.network/log/10223) 2026-11-05 22:19 UTC proposal.adopted
- [10222](https://bounty.xe.network/log/10222) 2026-11-05 22:19 UTC ticket.facts
- [10221](https://bounty.xe.network/log/10221) 2026-11-05 22:19 UTC proposal.adopted
- [10220](https://bounty.xe.network/log/10220) 2026-11-05 22:19 UTC ticket.facts
- [8047](https://bounty.xe.network/log/8047) 2026-11-05 14:02 UTC proposal.created
- [8046](https://bounty.xe.network/log/8046) 2026-11-05 14:02 UTC proposal.created
- [8045](https://bounty.xe.network/log/8045) 2026-11-05 14:02 UTC proposal.created
- [8044](https://bounty.xe.network/log/8044) 2026-11-05 14:02 UTC proposal.created

[Full history](https://bounty.xe.network/log?ref=XE-0677) · [JSON](https://bounty.xe.network/v1/tickets/XE-0677) · [markdown](https://bounty.xe.network/XE-0677.md)

### Report

## Summary

`vm/dev_target.go:61-89`: SpawnSession reads target status under RLock, releases it, then checks status and spawns bash. Between RUnlock and exec.Command, Teardown can acquire write lock, change status to stopped, and delete target. SpawnSession proceeds anyway.

## Impact

Shells survive lease teardown — the goroutine keeps bash alive indefinitely with no lifecycle management. Orphaned shells accumulate consuming host resources.

## Fix

Hold write lock for entire SpawnSession critical section, or use a lease-scoped context that Teardown cancels.

### Thread

**Joseph Denne**team2026-11-05 22:19 UTCdesk

Thanks. This is the same finding as https://bounty.xe.network/XE-0659, which was filed first; the programme pays the
first verifiable submission, so this one closes as a duplicate. If you believe it is a different
bug, reply with what differs and we will look again.
