Malware thrives on code you didn't look at. You didn't look at it because you didn't write it. Some web forum told you it was the proper way to do things, so you used it, because you're more afraid to look bad to a web forum than you are of looking bad to your boss, and now you have the vulnerabilities that came with it.
Simpler code is more robust code. Simpler code is code you can fully understand. Simpler code is code you can modify, rather than being stuck with it because you're afraid to touch it. Simpler code is code you can modify, because you don't have to have your changes accepted by a web forum or a remote dev team that doesn't give a crap about your changes.
Code you wrote yourself is code malware authors don't already know how to exploit.