# Swift deserialization security primer

DevFeed: [Swift deserialization security primer](<https://devfeed.tech/articles/swift-deserialization-security-primer-8198.md>)

Original publisher: [Read original article](<https://snyk.io/blog/swift-deserialization-security-primer/>)

Author: Sam Sanoop

Published: 2023-07-18T16:00:00Z

Content type: article

Language: en

Sources: [Blog RSS Feed | Snyk](<https://devfeed.tech/sources/blog-rss-feed-snyk.md>)

Topics: [Swift](<https://devfeed.tech/topics/swift.md>), [Security](<https://devfeed.tech/topics/security.md>), [Vulnerabilities](<https://devfeed.tech/topics/vulnerabilities.md>), [Code](<https://devfeed.tech/topics/code.md>), [Protocol (disambiguation)](<https://devfeed.tech/topics/protocol.md>)

Tags: [apis](<https://devfeed.tech/tags/apis.md>), [attacks](<https://devfeed.tech/tags/attacks.md>), [awareness](<https://devfeed.tech/tags/awareness.md>), [blog](<https://devfeed.tech/tags/blog.md>), [code](<https://devfeed.tech/tags/code.md>), [code-security](<https://devfeed.tech/tags/code-security.md>), [developer](<https://devfeed.tech/tags/developer.md>), [distributed](<https://devfeed.tech/tags/distributed.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [exploit](<https://devfeed.tech/tags/exploit.md>), [remote-code-execution](<https://devfeed.tech/tags/remote-code-execution.md>), [security](<https://devfeed.tech/tags/security.md>), [security-vulnerabilities](<https://devfeed.tech/tags/security-vulnerabilities.md>), [serialization](<https://devfeed.tech/tags/serialization.md>), [swift](<https://devfeed.tech/tags/swift.md>), [vulnerabilities](<https://devfeed.tech/tags/vulnerabilities.md>)

## AI overview

This Swift security primer explains how deserialization vulnerabilities can arise when using NSCoding and NSSecureCoding. It describes object substitution attacks, potential remote code execution, command injection, and stricter protections provided by NSSecureCoding.

## Source excerpt

This blog will detail deserialization vulnerabilities in Swift that can occur when using the popular APIs, NScoding and NSSecureCoding, and how to prevent it properly.