• Skip to main content

Naga Cyber Defense

Trusted Security for all of Indonesia

  • Home
  • About
  • Programs
  • Contact
  • Blog
You are here: Home / Archives for Keychain

Keychain

Cacat Keamanan iOS Ini Perlu Ditangani Di Setiap Aplikasi

March 2, 2022 by Eevee

Cacat dalam cara iOS menangani pencopotan pemasangan aplikasi berarti bahwa data Rantai Kunci yang sensitif tidak dihapus saat konten pengguna aplikasi lainnya dihapus. Ini memengaruhi sebagian besar aplikasi, bahkan aplikasi yang tidak langsung menggunakan Keychain.

Saat pengguna mencopot pemasangan aplikasi dari iPhone atau iPad mereka, mereka benar-benar mengharapkan data aplikasi tersebut dihapus sepenuhnya. Namun, ternyata, iOS tidak menghapus beberapa data paling sensitif yang mungkin disimpan oleh aplikasi, termasuk kata sandi dan token keamanan. Data itu akan tetap ada di perangkat Anda setelah aplikasi dihapus.

Dan faktanya, pengguna tidak memiliki cara untuk menghapus data ini sama sekali, kecuali menghapus seluruh ponsel mereka. Ini dapat menyebabkan masalah perusak privasi lainnya. Bayangkan situasi di mana seseorang menghapus semua aplikasi mereka untuk menyerahkan telepon kepada orang lain.

Cara yang tepat untuk melakukan ini tentu saja adalah dengan menggunakan fungsi “Hapus iPhone”, tetapi tidak semua konsumen mengetahuinya, Mereka akan menganggap bahwa semua data mereka telah dihapus. Namun pada kenyataannya pengguna baru berpotensi memiliki akses ke semua akun pemilik sebelumnya hanya dengan menginstal ulang aplikasi yang relevan.

Sebagian besar aplikasi tidak menggunakan Keychain secara langsung, karena mereka menggunakan perpustakaan pihak ketiga yang berfungsi untuk mereka (Firebase misalnya). Cacat ini memengaruhi aplikasi apa pun yang menggunakan Keychain secara langsung atau tidak langsung.

Jadi hal terbaik berikutnya adalah menghapus data Keychain setiap kali Anda mendeteksi bahwa aplikasi telah diinstal ulang. Itu tidak akan mencegah data tidak aktif di ponsel Anda, tetapi itu akan mencegahnya digunakan saat seharusnya tidak.

Kode terlihat seperti ini untuk aplikasi SwiftUI:

struct MyApp: App {
init() {
// Find if this is a first run of a fresh install
let defaults = UserDefaults.standard

// If the “IsSubsequentRun” key doesn’t exist, it’s a fresh
// install
if !defaults.bool(forKey: “IsSubsequentRun”) {

// …so we delete the whole keychain
deleteEntireKeychain()

// And set the key to true, so we know it’s not a fresh
// install any more.
defaults.set(true, forKey: “IsSubsequentRun”)
}
}
}

Untuk aplikasi UIKit, kode di dalam init() seharusnya diletakkan di fungsi app(_:didFinishLaunchingWithOptions:) AppDelegate Anda.
Dalam kedua kasus tersebut, pastikan kode dijalankan sebelum menginisialisasi pustaka apa pun yang mungkin menggunakan data Rantai Kunci (seperti Firebase).
Terakhir, tambahkan fungsi berikut yang dapat digunakan untuk menghapus seluruh data Rantai Kunci aplikasi Anda:

import Security

…

func deleteEntireKeychain() {
let secItemClasses = [
kSecClassGenericPassword,
kSecClassInternetPassword,
kSecClassCertificate,
kSecClassKey,
kSecClassIdentity
]

// Query every item in each security class
for secItemClass in secItemClasses {
let query: NSDictionary = [
kSecClass: secItemClass,
kSecAttrSynchronizable: kSecAttrSynchronizableAny
]

// …and delete those items
SecItemDelete(query)
}
}

Ini adalah kelemahan keamanan yang merusak privasi. Ini menyebabkan data sensitif yang diharapkan pengguna telah dihapus, pada kenyataannya bertahan. Tidak ada solusi lengkap. Namun, kode di atas setidaknya akan menjamin bahwa data apa pun yang sebelumnya harus dihapus, tidak dapat digunakan di aplikasi Anda.

Sumber : Medium

Tagged With: Aplikasi, BIOS, Keychain, SwiftUI, UIKit

Copyright © 2025 · Naga Cyber Defense · Sitemap

Cookies Settings
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
AcceptReject AllCookie Settings
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
CookieDurationDescription
_ga2 yearsThe _ga cookie, installed by Google Analytics, calculates visitor, session and campaign data and also keeps track of site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognize unique visitors.
_gat_gtag_UA_172707709_11 minuteSet by Google to distinguish users.
_gid1 dayInstalled by Google Analytics, _gid cookie stores information on how visitors use a website, while also creating an analytics report of the website's performance. Some of the data that are collected include the number of visitors, their source, and the pages they visit anonymously.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
non-necessary
SAVE & ACCEPT
Powered by CookieYes Logo