NHS boards have faced 117 cyber attacks, with one facing an offensive from North Korea, in the past five years.
The totalitarian regime is accused of hacking NHS Borders in 2017, though it is unclear what the reason for the attack was.
In response to a Freedom of Information request by the Scottish Conservatives, six health boards said their cyber defences had been successfully breached.
NHS Lanarkshire topped the table with 62 attacks sustained since 2014, with NHS Fife coming second with 47.
The Western Isles health board received five attacks, while NHS Greater Glasgow and Clyde, Grampian and Borders all were the victims of one attack.
Each of the health boards which reported they were successfully attacked, barring NHS Borders, were hit by the Wannacry ransomware hack in 2017, which the Telegraph reports cost the NHS in the UK £92 million to defend.
Hackers used a weakness in the Windows operating system, developed by the National Security Agency in the US, to hack into systems and encrypt data, demanding payments in Bitcoin to free the information.
The true number of hacks is likely to be higher, given that some boards did not hold the information requested.
Maurice Golden, the Scottish Conservatives’ chief whip, said: “These revelations show even Scotland’s NHS isn’t safe from global hackers.
“Patients will be alarmed that their sensitive data is being pursued by North Korean hackers.
“Thankfully, it seems our health service is well-equipped to repel these attacks, and that’s a tribute to the IT teams working hard to keep our personal information safe.
“But there’s no room for complacency, and hackers across the world are getting better all the time at attacking these systems.
“The NHS has many plates to spin, against a backdrop of dwindling support from the SNP Government, but this is one area that must be maintained.”