I'm trying to understand the whole process behind the Sambacry exploit. The problem is that I'm having a little problem understanding how do you create the malicious .so library to be loaded by the exploit. I tried several techniques and they don't work. I see some precompiled examples in github but I really want to understand how to create a bind or reverse generic linux shell and output it in .so format.
I've tried msfvenom outputting to elf-so and elf to no avail.
Can you help me understand how can I create a malicious samba .so library?
PS: This question IS NOT addressed here, I'm not asking about the exploitation process, I'm asking about the creation of the payload. Please don't tag it as a duplicate.