iPhones are substantially safer than most general-purpose computers, but they are not immune to malware. Apple's iOS design removes entire classes of attack—unvetted third-party app stores, unsigned code execution, and broad background process access—while leaving real risks that target the user rather than the hardware: phishing, malicious configuration profiles, enterprise sideloading abuse, and, historically, sophisticated exploit chains used in targeted spyware.
Understanding where the protection holds and where it thins out is more useful than a yes-or-no verdict.
The short answer, and why it isn't just marketing
The iPhone's security posture rests on several layered mechanisms that make conventional malware—self-installing viruses, drive-by downloads that silently execute code, ransomware that encrypts your files—rare and structurally difficult. iOS apps run in sandboxes that limit what each app can read, Apple signs every app that runs on a stock device, and the operating system enforces code signing at the kernel level.
The result is that a typical malicious app cannot copy itself into other apps, cannot quietly install a second payload, and cannot persist in the background the way Windows malware often does.
That's the protection. The caveat is that "safe from malware" is a sliding scale, not a switch. The threats that reach iPhones either bypass the app model (through exploits or configuration abuse) or skip malware entirely and go after the person (phishing, social engineering, account takeover). Apple's own platform security documentation describes the architecture in detail, and independent security research consistently finds iOS hardened against mass-market malware even as it remains vulnerable to targeted exploitation.
The mechanisms that make ordinary malware hard on iOS
Three design decisions do most of the work, and it helps to know them because they also tell you where the gaps are.
Code signing and the app review pipeline. On a stock iPhone, apps must be cryptographically signed by Apple or by a developer with a valid certificate. Apps distributed through the App Store go through review and are re-signed.
An app you download cannot simply contain executable code that runs later—strictly speaking, the system requires executable code to be signed, so apps cannot dynamically load arbitrary unsigned binaries in the way desktop software can. This shuts down the classic malware tactic of "installer that fetches a payload."
Sandboxing. Each app gets its own container and a limited set of entitlements. One app can't read another's files without explicit sharing through system frameworks, and can't access the file system, camera, microphone, contacts, or location without user permission prompts. Malware that wants to harvest data broadly has to trick the user into granting each permission, or exploit the kernel to escape the sandbox.
Hardware-backed key storage and secure boot. The Secure Enclave holds encryption keys and biometric data separately from the main processor, and secure boot verifies the integrity of the OS at startup. These features make persistent, tamper-resistant malware—the kind that survives reboots and modifies system files—much harder to plant on a device that hasn't been jailbroken or exploited.
Together these mechanisms mean that the "wild" malware ecosystem familiar from Android and Windows—adware bundles, SMS Trojans, banking overlays that install themselves—has no easy foothold on an unmodified iPhone.
What actually gets through: exploits, profiles, and sideloading
The realistic iPhone malware stories cluster into a few categories, and each requires something beyond "download a bad app."
Targeted exploit chains (spyware). Commercial spyware such as Pegasus, developed by NSO Group, and similar tools from other vendors have repeatedly used chains of zero-day vulnerabilities to compromise iPhones without any user interaction—sometimes via a malicious iMessage or a crafted link. These are not mass-market malware; they're expensive, narrowly deployed against journalists, activists, lawyers, and executives.
Apple has sued NSO Group and shipped rapid security responses and Lockdown Mode specifically to reduce this exposure. Security researchers have documented these campaigns in detail (the Citizen Lab at the University of Toronto has published multiple analyses). For an ordinary user, the probability of encountering such an attack is very low, but it's the clearest example of iPhone malware that genuinely exists.
Configuration profiles and supervision abuse. iOS lets users install configuration profiles—XML files that can set policies, install certificates, or route traffic through a proxy. Attackers use these in social-engineering campaigns ("install this to get free data / to join the beta / to fix your Wi-Fi") to intercept traffic, install root certificates that enable man-in-the-middle attacks, or enroll a device in mobile device management.
A malicious profile isn't classic malware, but it can give an attacker meaningful control. Checking Settings > General > VPN & Device Management for unexpected profiles is a genuine, practical defense.
Sideloading and enterprise certificate abuse. Outside the App Store, apps can be installed through enterprise certificates (intended for internal corporate distribution), developer certificates, or—in the EU, following the Digital Markets Act—alternative app marketplaces. Each expands the attack surface. Malicious "free movie" or "modded app" sites distribute apps signed with abused enterprise certificates, which Apple revokes when discovered.
The app can still run until revocation, and it runs with the permissions the user grants. This is the closest thing to conventional iPhone malware for consumers, and it depends entirely on the user choosing to install something outside the App Store.
Phishing and account takeover. Most "my iPhone got hacked" reports resolve to credential theft, not malware. Fake Apple ID login pages, SMS phishing ("your package is held"), and social engineering against iCloud accounts are common. Multi-factor authentication, passkeys, and Apple's Advanced Data Protection for iCloud address this, but no operating system prevents a user from typing a password into a convincing fake page.
Jailbreaking. A jailbroken iPhone deliberately disables code signing and sandbox restrictions, which reopens the door to malware. Jailbreaking is rare, increasingly difficult on recent iOS versions, and directly trades security for customization. If a device is jailbroken, the protections described above largely don't apply.
How iPhone risk compares to Android and desktop
The comparison is genuinely useful because it calibrates expectations. Android's more open model—sideloading is a standard feature, and multiple app stores operate—has historically produced more consumer-facing malware, though Google Play Protect and modern Android versions have narrowed the gap. Windows and macOS run arbitrary executables, so a downloaded file can install malware directly; phishing that delivers a malicious installer is a routine desktop attack.
iOS sits at the locked-down end: fewer routes in, which reduces mass-market malware, but the routes that remain (exploits, profiles, sideloading) are the ones that matter. The table below summarizes the practical differences for a typical user deciding how much caution to apply.
| Risk factor | Stock iPhone | Typical Android phone | Desktop (Windows/macOS) |
|---|---|---|---|
| Arbitrary downloaded executables | Blocked by code signing | Possible with sideloading | Standard |
| Third-party app stores | Not on stock devices outside EU | Common | Normal |
| Silent self-installation of malware | Very difficult | Possible | Common |
| Targeted zero-click exploits | Documented, rare | Documented, rare | Documented, uncommon |
| Phishing and credential theft | Common | Common | Common |
| Main user-side risk | Sideloading, profiles, phishing | Sideloading, malicious apps | Malicious installers, phishing |
The pattern: iPhones reduce the technical attack surface but not the human one. Desktop and Android users who are careful face similar real-world risk; careless iPhone users still get phished.
Practical signs an iPhone may actually be compromised
Genuine malware symptoms on iPhone are subtle because well-built spyware avoids detection. The signals worth investigating, roughly in order of how much they suggest a real problem:
- An unexpected configuration profile or device management entry. Settings > General > VPN & Device Management showing something you didn't install is a real red flag.
- A jailbreak-related app or Cydia present. Indicates the device was modified.
- Unexplained battery drain, heat, or data usage combined with other signs. Spyware that exfiltrates location or messages can cause these, but so can a failing battery or a buggy app; treat it as a prompt to investigate, not proof.
- Apple ID security notifications you didn't trigger—new sign-ins, password changes, or trusted device additions. This usually points to account compromise rather than device malware.
- Rapid security responses or Lockdown Mode prompts you didn't expect. Lockdown Mode is opt-in and reduces attack surface for high-risk users; an unexpected activation is worth understanding.
A slow phone, a hot phone, or a phone that "feels hacked" is almost never malware. Most such reports trace to background app refresh, a failing battery, storage pressure, or a phishing scare.
What to do if you suspect infection, and how to reduce risk
Apple's guidance for a suspected compromise is to update iOS, remove unknown profiles, change your Apple ID password, and—for severe cases—erase and set up as new rather than restoring from a backup that might reintroduce the problem. Restoring from a backup taken while compromised can carry over the malicious profile or data. Erasing and setting up fresh is the only reliable way to remove persistent threats on a device you can't otherwise clean.
For everyday risk reduction, the highest-value steps are unglamorous:
- Keep iOS updated. Most real-world iPhone exploitation targets known vulnerabilities patched in updates.
- Don't install apps outside the App Store unless you have a specific reason and trust the source; avoid "free premium" app sites entirely.
- Decline unexpected configuration profiles and check that settings page periodically.
- Use a password manager and passkeys, and enable two-factor authentication on your Apple ID. This defeats most phishing.
- Consider Lockdown Mode if you're a high-risk target—journalist, activist, executive, or someone who suspects targeted surveillance. Apple documents what it disables.
- Treat "your iPhone is infected, click here" messages as scams, because that's what they almost always are.
Why "iPhone can't get malware" is the wrong mental model
The belief that iPhones are immune leads to two costly mistakes: ignoring phishing because "the phone can't get viruses," and installing shady profiles or sideloaded apps because "iOS blocks malware anyway." Both assumptions are false in ways that matter. iOS raises the cost of conventional malware enormously, but the threats that remain are exactly the ones that rely on the user lowering their guard.
A more accurate model: the iPhone is a locked building with good locks, but the attacker can still call you and ask you to open the door. The locks stop the burglar who tries the windows; they don't stop the person who convinces you to hand over the key.
That framing also explains why security advice for iPhones concentrates on account security, profiles, and update hygiene rather than antivirus apps—and why "antivirus for iPhone" apps on the App Store are largely unnecessary for malware and mostly useful for things like VPNs, phishing protection in browsers, and device monitoring.
Frequently Asked Questions
Can an iPhone get a virus from a website?
A normal website cannot silently install malware on a stock iPhone, because iOS won't execute downloaded code outside the signed app model. What a malicious site can do is phish your credentials, trick you into installing a configuration profile, or—very rarely—serve an exploit against an unpatched iOS version. Keeping iOS updated and refusing profile installs closes most of that gap.
Do I need antivirus software on an iPhone?
No, not for conventional malware. The App Store's review and code-signing model, plus sandboxing, leave little for a consumer antivirus app to scan. Apps marketed as security tools are usually VPNs in disguise, browser phishing filters, or parental monitoring. They can add value in those specific roles, but they don't function like desktop antivirus.
Can you get malware from a text message on iPhone?
A text message itself doesn't install malware, but it can carry a malicious link or attempt a zero-click exploit against iMessage. The former is phishing—don't tap, and verify the sender. The latter is the domain of targeted spyware and is rare for ordinary users; Apple has shipped iMessage security improvements and Lockdown Mode specifically to reduce it.
How do I know if my iPhone has a virus or spyware?
Check Settings > General > VPN & Device Management for profiles you didn't install, look for jailbreak tools, and review Apple ID sign-in activity. Persistent battery drain, heat, or data spikes are weak signals that warrant investigation but rarely prove malware. If you have a concrete reason to suspect compromise, updating, removing unknown profiles, changing your Apple ID password, and erasing the device are the reliable steps.
Is a jailbroken iPhone more vulnerable to malware?
Yes. Jailbreaking disables code signing and weakens sandbox enforcement, which is exactly what conventional malware needs. A jailbroken phone should be treated as a device with substantially reduced built-in protection, and many security-sensitive apps (banking, payment) refuse to run on it for that reason.
Are older iPhones that no longer get updates still safe?
They're less safe over time. Once a device stops receiving iOS updates, newly discovered vulnerabilities go unpatched, and the exploit surface grows. An iPhone that still receives security updates is meaningfully protected; one that doesn't should be treated with more caution, especially for high-value accounts, and replaced when practical.