Praise be to Allah, and peace and blessings be upon the Messenger of Allah and his family.
Firstly:
Auditing the accounts of customers who deal with riba is haram work, because it involves approving of riba, writing it down, and keeping quiet about it and not denouncing it.
Please see the answers to questions no. 108105 and 118189 .
Secondly:
Muslim (1598) narrated that Jaabir said: The Messenger of Allah (blessings and peace of Allah be upon him) cursed the one who consumes riba and the one who pays it, the one who writes it down and the two who witness it, and he said: they are all the same.
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said:
That is, (they are all the same) in terms of being cursed, because they co-operated in that.
End quote from Fataawa Noor ‘ala ad-Darb, 16/2
Imam al-Bukhaari (may Allah have mercy on him) referred to this hadith that was narrated by Imam Muslim in the title which he gave to a chapter of his Saheeh, which he called: Chapter on the one who consumes riba, the one who witnesses it and the one who writes it down.
Then he quoted two hadiths in this chapter, one of which was the hadith of ‘Aa’ishah: When the last part of al-Baqarah was revealed, the Prophet (blessings and peace of Allah be upon him) recited it, then he forbade trade in alcohol. The second hadith is the hadith of Samurah, according to which the Prophet (blessings and peace of Allah be upon him) said: “Last night, I dreamt that two men came to me and took me out to a sacred land, then we set out until we came to a river of blood in which a man was standing, and on the bank of the river there was another man in front of whom were some rocks. The man who was in the river came, and when he wanted to get out, the (other) man threw a rock in his mouth, and sent him back to where he had been. Every time he came and wanted to get out, he threw a rock into his mouth and sent him back to where he had been. I said: ‘What is this?’ He said: ‘The one who you saw in the river is the one who consumed riba.’
Al-Haafiz Ibn Hajar (may Allah have mercy on him) said:
Ibn at-Teen said: There is no mention in these two hadiths of the one who writes down riba and the one who witnesses it. My response is that he mentioned them by implication because they help the one who consumes it to do so. This only applies to the one who helps the one who is engaging in riba. As for the one who writes it down or who witnesses the deal in order to tell exactly what happened, this is a good intention and is not included in the warning mentioned. Rather what is included is the one who helps the one who is engaging in riba by writing it down and witnessing it; his status is the same as that of the one who says “Trading is only like Riba (usury)” [al-Baqarah 2:275]. End quote.
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said:
The one who helps another to commit sin will incur a burden of sin as much as he deserves. It is proven that the Prophet (blessings and peace of Allah be upon him) cursed the one who consumes riba, the one who pays it, the two who witness it and the one who writes it down, because the two witnesses and the one who writes it down are helping to confirm this transaction, so they incur whatever they deserve of the curse.
End quote from al-Liqa’ ash-Shahri, 35/24
In fact what we have previously affirmed on our website does not differ in the slightest from what we have quoted here and what the questioner has quoted from al-Haafiz Ibn Hajar or from al-Abi (may Allah have mercy on them both).
Auditing bank accounts or the accounts of riba-based companies comes under the heading of helping in the haram riba transaction and participating in it; it is not possible to complete riba-based deals without the help of accountants.
But there remain these two forms that are not included in haram writing down or witnessing:
1.
Where one witnesses or writes down the deal in order to document it and testify to the involvement of the people who are party to it, as was mentioned by al-Haafiz Ibn Hajar (may Allah have mercy on him). This is like one who sees a crime such as murder or theft taking place, so he takes pictures, or he writes down what happened, so that he may give testimony concerning it before the judge and help to catch the perpetrator and help justice. This person has nothing to do with the criminal act and therefore has nothing to do with the perpetrator. And he is not helping with the sin or crime in any way whatsoever; rathe, in fact he was striving to change evil and establish justice to the best of his ability.
This is what al-Haafiz Ibn Hajar (may Allah have mercy on him) was referring to, and in our previous answers we were not suggesting that this kind of action is haram; rather it is something that is Islamically prescribed and is necessary.
2.
Where a person or company or accounts department enters into a transaction with another person or company or firm that deals with riba or other haram transactions, but the first party has nothing to do with its haram actions; rather he or they are dealing with them within the limits of permissible transactions and contracts.
For example, the company may be dealing with riba-based transactions, but my job is supervising a permissible project that does not involve any riba-based transactions, or their riba-based transactions are between them and the bank, and someone else takes care of dealing with customers, buying and selling and so on, which has nothing to do with the riba-based transactions. In such cases, there is no blame on the one who deals with the company or plays any part in it. We have never disallowed this type of involvement before; rather we stated clearly that this is permissible
Shaykh Ibn ‘Uthaymeen said:
It is permissible for a person to deal with someone who deals with riba, but his interactions with him are done in a sound manner. For example, it is permissible to buy goods from this man who deals in riba, and it is permissible to borrow money from him, and there is nothing wrong with that. The Prophet (blessings and peace of Allah be upon him) used to interact with the Jews, even though they used to consume haram wealth; he used to accept their gifts and invitations, and he bought and sold with them too.
To sum up: if a person earns money from haram sources but you deal with him in a permissible transaction, there is no blame on you for doing so.
End quote from Fataawa Noor ‘ala ad-Darb, 16/2
See also the answer to question no. 11315
And Allah knows best.