The Royal Canadian Mounted Police (RCMP) said Stephen Arthuro Solis-Reyes was arrested at his London, Ontario home on Tuesday without incident.
He is scheduled to appear in court on Thursday to face charges of mischief and unauthorized use of a computer to steal data from the Canada Revenue Agency (CRA)'s website.
"It is believed that Solis-Reyes was able to extract private information held by the CRA by exploiting the security vulnerability known as the Heartbleed Bug," the RCMP said in a statement.
The suspect was tracked down within four days after what CRA Assistant Commissioner Gilles Michaud had described as a serious security breach.
Police said computer equipment was seized at the suspect's home, and that the investigation is still ongoing.
The Canada Revenue Agency said 900 social insurance numbers personal nine-digit codes required for working or accessing government benefits in Canada had been stolen last week by "someone exploiting the Heartbleed vulnerability."
Its website was shuttered for several days over concerns about the Heartbleed bug.
It was rebooted over the weekend after a patch was installed.
The recently-discovered flaw in online-data scrambling software OpenSSL allows hackers to eavesdrop on online communications, steal data, impersonate websites and unlock encrypted data.
OpenSSL is commonly used to protect passwords, credit card numbers and other data sent via the Internet.
More than half of websites use the software, but not all versions have the same vulnerability, according to heartbleed.com.
Cybersecurity firm Fox-It estimates that the vulnerability has existed for about two years, since the version of OpenSSL at issue was released.