課程:App資安規劃與實作
Last updated
Was this helpful?
Last updated
Was this helpful?
NSExceptionAllowsInsecureHTTPLoads
NSIncludesSubdomains
使用 RNCryptor 或 Keychain 做檔案加密
使用 Trustkit 做 SSL Pining (OWASP推薦)
檢測網站憑證用,包含查看SSL pin
SSL pin = Base64(SHA256(Public Key))
Home
Hostname
Report
SSL Pin 1
SSL Pin 2
Host domain 在程式碼中,應以密文形式存在
加密的 Key 可用 Computed property 來做,比直接寫一個值好
// Not good
let key = "123456"
// Not good, it will keep in memory when class initial
let key: String =
{
return "12"+String(30+4)+String(7*8)
}()
// Good
var key: String
{
return "12"+String(30+4)+String(7*8)
}
做動態記憶體偵測反制
在AppDelegate,將 @UIApplicationMain 註解掉
新增 main.swift
import Foundation
import UIKit
_ = autoreleasepool {
UIApplicationMain(
CommandLine.argc,
UnsafeMutableRawPointer(CommandLine.unsafeArgv)
.bindMemory(
to: UnsafeMutablePointer<Int8>.self,
capacity: Int(CommandLine.argc)),
nil,
NSStringFromClass(AppDelegate.self) //Or your class name
)
}
新增 DisableTrace.swift (停止 Debug mode)
使用 macro,在 Release 模式時才反制
使用 @inline(__always)