Duh!
"Developers' enthusiasm for sharing code saves their colleagues' time, but also means they share security bugs they haven't noticed. And that means a smart attacker could follow who's shared what with whom to trawl the Web for vulnerabilities."
So researches have looked into this and came to conclude what most of us already knew for nearly 10 years now? Some slow researches those are...
I know of a solution though: hold people accountable for the stuff they post.
I've seen this so many times: a person has a somewhat common problem and someone else presents a small piece of code as the solution. Unfortunately that code comes close but doesn't quite solve the issue just yet. But despite that you'll see dozens of people copying and spreading it as if this solution was their own. For the simple reason that they have no clue what. so. ever. what they're doing nor copying yet hope to become more popular for sharing the solution to an infamous issue.
So yeah: hold people accountable. Post bad code? The kind of stuff you could have known doesn't work by simply trying? Bzzzt., penalty time.
I think some copy cats would be quickly gone