All perfect praise be to Allah, The Lord of The Worlds, and may His peace and blessings be upon our Prophet Mohammad and upon all his family and companions.
Social security benefits aren`t given in exchange for the salaries that a subscriber used to be paid prior to his/her retirement; rather, they are given as a donation and out of solidarity. However, if the person had covered his/her subscriptions in the Social Security Corporation with unlawful money, this doesn`t render the benefits, that he/she is entitled to receive from that Corporation, unlawful.
The contract between these two parties isn`t commutative; rather, it is one of donation and benevolence, and this is the view adopted by the Iftaa Council`s Resolution No.(174).
Accordingly, there is no harm that heirs receive the social security benefits of their deceased father. And Allah knows best.