It could provide hackers with a treasure trove of information they could use to design new attacks against Apple’s operating system iOS.
The code has seemingly been taken from the “iBoot” part of the iOS, the part of the computer that begins to boot the operating system when it is turned on.
Although it is not yet known whether the code came from inside Apple, security researchers believe it is authentic.
Speaking to online technology publication Motherboard, Jonathan Levin, an expert on iPhone internal software, said: “This is the biggest leak in history. It’s a huge deal.”
Mr Levin told Motherboard that the code seemed to be legitimate as it matched his own efforts to reverse engineer the software that powers iPhones.
The code was for the outdated iOS 9, released in September 2015, but it is expected that parts of the code may still be in use underpinning the iPhone’s security in later releases.
Although initially published to a repository on programming website GitHub, the code has now been replaced with a copyright notice – with some suggesting this may prove its authenticity.
Andy Kays, chief technology officer at British cybersecurity firm Redscan, told Sky News: “The release of the iBoot code demonstrates that vendors can’t take it for granted that source code will always remain hidden.
“Vendors relying excessively on code obfuscation to maintain the security of their products will always be vulnerable to leaks.”
More from Apple
iPhone sales dip but Apple still hits record revenues
iPhone slowdown scandal: US authorities launch an investigation
Tech giant Qualcomm fined £872m over illegal Apple payments
Apple employees to get bonuses of $2,500 in stock
iPhone ‘text bomb’ can crash your phone by text
Hacker pleads guilty to stealing stars’ intimate pictures
Mr Kays said that Apple has taken important steps to improve the protection of its products “so users of its latest devices don’t need to be unduly concerned by the release of the iBoot firmware.”
Sky News has contacted Apple for a comment.