Dirpersist saves and restores your directory stack across shell invocations, thus preserving important state so that you can resume work where you left off.
The idea is pretty straightforward: Insert some attack code (for example, code that invokes a shell) somewhere and overwrite the stack in such a way that control gets passed to the attack code.
The plug-in is composed of three functions, a handful of shell options, and an alias for popd that persists the directory stack with each pop operation.