My question involves landlord-tenant law in the State of: New York

I rented a room in a house a couple miles from campus. The person who held the lease required a security deposit of $590. He said the he would give the security deposit to the owner of the house, the person he was leasing it from. I did Not sign the lease, nor did anyone else that was renting a room (4 people total) in the house except the one person who has been in the house for the past 3 years. I lived in the house for 10 months until I moved out on May 23rd. I told the guy whose name was on the lease that was will be moving out 1.5 weeks prior and I was willing to pay the half months rent for June due to the short notice. After I moved out I went traveling for 3 weeks. After I got back, the person who name was on the lease told me that because the person that was supposed to move in after me actually scammed him for $1700,he used my security deposit for the rent. What am I supposed to do? Is he allowed to use my security deposit for rent with the excuse that because he was scammed he needed to pay the rent?