Bonus Repayment

I had a bonus of $5K that was paid to me in 2023. I had to repay it because I left the company. I had to pay back the gross amount of $5K in 2024. My old company just put that against my gross wages in 2024 and did not do anything with taxes that were paid. I think that it will be fine for federal and local wages because I can just get a refund this year, however, I am not sure how to handle social security and medicare. Can you please tell me the correct way to approach that?