You can't "live out" the security. The security is intended as collateral in case you cause damage to the apartment, so the landlord can use it for repairs after you leave - it cannot be used to pay down an outstanding rent balance.
Since the apartment is a basement, it's probably "illegal" in the sense that there's no C/O, but as far as I know, that doesn't change your obligation to pay rent for living there as you've already agreed to do - check out this page
» What Every Tenant Should Know Nassau/Suffolk Law Services Committee, Inc. for more information.