Pearce Delphin, whose Twitter name is @zzap, admitted exposing a security flaw which was then pounced upon by hackers, affecting thousands of users and causing havoc on the microblogging site for about five hours.
But the idea was soon taken up by hackers who tweaked the code to redirect users to pornographic sites and create “worm” tweets that replicated every time they were read.
“At the time of posting the tweet, I had no idea it was going to take off how it did. I just hadn’t even considered it.”
Twitter apologised to its millions of users after the “mouseover bug” raged through the site, opening pop-up windows in Web browsers and automatically generating tweets from other accounts.
White House press secretary Robert Gibbs and Sarah Brown, wife of Britain’s former prime minister Gordon Brown, were among those hit by the bug before engineers patched it up.
The “Netcraft” security website traced the malicious code back to Delphin, who said he got the idea from another user who employed a similar code to make his profile and tweets rainbow-coloured.
“After that, it seems like some of my followers realised the power of this vulnerability, and within a matter of minutes scripts had taken over my timeline,” Delphin said.
The glitch was mainly used for pranks, but Delphin said it could have been used to “maliciously steal user account details”.
“The problem was being able to write the code that can steal usernames and passwords while still remaining under Twitter’s 140 character tweet limit,” he said.
“Luckily, no one, as far as Twitter admits, actually used this to extract passwords from users.”
Experts said the problem could have been exploited for more sinister purposes by hackers redirecting users to third-party websites containing malicious code, or for spam advertising.
Delphin was one of the first people in Australia to start using Twitter, back in 2006, and said the site had known about the problem for “months” but failed to patch it.
The teen is just a few weeks off graduating from high school and hopes to study law. He had not yet told his parents about the cyberstorm he’d created.
“I discovered a vulnerability, I didn’t create a self-replicating worm. As far as I know, that isn’t technically illegal,” he said.
“Hopefully I won’t get in trouble!” he added.
Twitter, which allows users to post messages of 140 characters or fewer, says it has over 145 million registered users firing off more than 90 million tweets a day.
It unveiled a major redesign of its website a week ago that is being slowly rolled out to users of the service across the globe. The company said the attack was not connected to Twitter’s revamp.