First, not all leases require security deposits. Each leasing company has their own policy for how to handle any security deposits during a lease transfer.
Some lease companies return the deposit to the original lessee and require a new deposit from the assuming lessee. Others allow the security deposit to transfer to the new lessee.
The disposition of any security deposit is often a point of negotiation between the Lease Seller and Lease Buyer as well.