Nonsuperintelligent AI threat

Something that I don’t think I’ve seen discussed here is the threat posed by an AI which is smarter than we are when it comes to computer security without being generally intelligent.

Suppose there were a computer virus that could read code, to the extent of looking at the programs on a computer, seeing how they process input from the internet, and how they could be exploited to run arbitrary code. Historically, viruses have been annoyances. How much smarter would a virus have to be in order to be a threat on the scale of say, a planetary EMP burst?