skills/vulnerability-patterns/arbitrary-storage-location/SKILL.md
- Contract has a dynamic array in storage
npx skillsauth add apegurus/solidity-argus arbitrary-storage-locationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
sstore with a user-controlled slot valueuint256[] public data;
address public owner;
function write(uint256 index, uint256 value) external {
// User controls index — can compute an index that maps
// to any storage slot via the array's storage layout:
// array elements start at keccak256(slot_of_length)
// attacker calculates index to target owner's slot
data[index] = value;
}
// Assembly variant
function writeSlot(uint256 slot, uint256 value) external {
assembly {
sstore(slot, value) // Direct arbitrary storage write
}
}
require(index < data.length))sstore in assembly blocks — check if the slot parameter is user-controlled.length assignments on dynamic arrays (Solidity <0.6.0 allowed array.length = X, enabling array expansion to reach any slot)array.length before writingpush() only (indices are not user-controlled)sstore uses a hardcoded or internally computed slot.length manipulationrequire(index < data.length)push() and pop() instead of direct index assignment for dynamic arrayssstore with user-controlled slot valuesfunction safeWrite(uint256 index, uint256 value) external {
require(index < data.length, "out of bounds");
data[index] = value;
}
testing
Specialist profile for mechanically applying the attack-vector deck and classifying vectors as skip, drop, or investigate.
tools
Specialist profile for libraries, helpers, base contracts, adapters, encoders, wrappers, and integration glue.
testing
Specialist profile for rounding, scale, decimal, downcast, and arithmetic accounting edge cases.
testing
Specialist profile for extracting conservation laws and state couplings, then searching for violating paths.