He worked as a programmer for a company but they did not give him his dues; can he sell some of their programs to get his money?
Question

I was working as a programmer in a company for a monthly salary. After four years of service, I left that job, and I did not get everything that I was entitled to from them, despite their promises. After that, they asked me to do some additional programming tasks on the systems that I had developed for them, in return for an additional payment, as well as payment of everything that I was previously owed. Of course, ownership of the programs produced would be theirs. I agreed to that in an attempt to salvage what they owed me. But after ten months, I submitted the work in full. Then they stopped returning my calls, then I found out that the system that I had developed had been sold and installed for several customers and government departments, and they are still selling it. My question is: as they have broken the agreement, and have not paid me what they were supposed to, can ownership of these programs be regarded as belonging to me, including what I did of developing it during the time I worked for them, and then can I sell it and would the earnings be halaal?
Praise be to Allah.If an employee develops a program for a company, then ownership of the program belongs to the company, but he can stipulate that his efforts be acknowledged, by mentioning his name and the work he did on the program.
If the company did not give you your rights, then you worked on development of the program for an additional payment, which has not been given to you, then all of that is a debt that is owed by the company, and you may try to obtain it by legitimate means, which includes referring the matter to the courts.
With regard to ownership of the programs, it remains with the company and does not pass from the company to you as a result of their delay in giving you your dues.
But if you cannot get what you are entitled to, after going through legitimate means, it is permissible for you to sell the programs as much as will allow you to recover what you are owed, without going beyond that. This is what is known to the scholars as mas’alat az-zafar (the opportunity to salvage what one is owed), on condition that you do not expose yourself to accusations of theft.
Ibn al-Mulaqqin (may Allah have mercy on him) said: If someone is owed something by someone else, and he is unable to obtain it, it is permissible for him to take from him as much as he is entitled to, without his permission and without asking him. This is the view of ash-Shaafa‘i and his companions; it is called mas’alat az-zafar (the opportunity to salvage what one is owed).
Abu Haneefah and Maalik did not allow that, as was narrated by an-Nawawi in his commentary on Muslim.
Al-Qurtubi said: This view is well known in the madhhab of Maalik.
It was narrated from Abu Haneefah that he may take wealth of the same type as what he is entitled to, but he should not take anything else, unless he is taking dirhams (silver coins) instead of dinars (gold coins), or vice versa.
It was narrated from Ahmad that he should not take wealth of the same type or otherwise.
It was narrated from Maalik that if the debtor does not have any other debt [i.e., to someone other than the person to whom this is owed], then he may take it, but if he does owe other debts, he should not take anything except an amount proportionate to what he is owed.
Al-Maaziri narrated three views from Maalik, the third of which is that it is permissible for the one who has the opportunity to take something of the same nature as what he is owed to do so, otherwise it is not.
End quote from al-I‘laam bi Fawaa’id ‘Umdat al-Ahkaam (10/17),
And Allah knows best.