BM Podcast TestOctober 17, 202600:30:171.05 GB

Multi-audio

..

[00:00:28] - [Speaker 0]
Unser nächster Vortragender arbeitet bei den Pajato Security Labs und sucht gerne nach Sicherheitslücken in Microsoft Edge. Applaus für Nikkij Mitan. Willkommen zu meinem Vortrag über die Sicherheit des Microsoft Edward Brothers. Mein Name ist Michel. Ich arbeite in Pajato Labs und forsche zur Sicherheit von Webbrowsern.

[00:01:02] - [Speaker 0]
Zu Beginn meines Vortrages würde ich gerne wissen, wie viele von euch Browsererweiterungen überhaupt verwenden. Eine Browsererweiterung ist etwas, was die Möglichkeiten, die Fähigkeiten eures Webbrowsers erweitert. Typische Beispiele sind zum Beispiel Adblock plus, das viele nutzen, Werbung auf bestimmten Websites wie zum Beispiel Youtube zu blockieren oder Grammily, Passwortmanager sind auch häufig Browsererweiterungen und diese Erweiterungen können einen Großteil eurer Daten verwalten. Sie können zum Beispiel Cookies, Lesezeichen, Passwörter, die den Browserverlauf und so weiter verwalten. Das bedeutet also, dass wir alle zustimmen müssen, dass diese Erweiterungen mächtig sind, weil sie eben Cookies, Lesezeichen und weitere sensible Informationen des Browsers lesen können.

[00:02:00] - [Speaker 0]
So sieht die Adblock Plus Erweiterung in einem im auf Microsoft Edge aus. Habt ihr euch aber jemals überlegt, was diese Erweiterung vielleicht in eurem Browser tun kann? Wenn ihr euch die Einstellungen anschaut, dann seht ihr, dass es einige Erlaubnisse gibt. Diese einfache Adblock Plus Erweiterung kann also den Inhalt der Seiten, die ihr besucht, lesen und verändern. Es kann er kann die alle Seiten sehen, die ihr besucht und alle Daten lesen, die in und in euren Browser von eurem Browser herunter- hochgeladen werden und es kann auch Notifications anzeigen.

[00:02:53] - [Speaker 0]
So eine einfache Erweiterung kann also so viele Sachen in eurem Browser anstellen. Also könnt fragt ihr euch vielleicht, wie Browser diese Erlaubnisse erkennen. Die Erweiterung kann so viele Sachen in meinem Browser tun, aber wo kam diese Erlaubnis überhaupt her?

[00:03:10] - [Speaker 1]
Hier

[00:03:13] - [Speaker 0]
ist ein Erlaubnis das Erlaubnismodell einer Browsererweiterung. Hier haben wir eine Datei, die Manifest Punkt JSON heißt. In dieser Datei gibt ein Array namens, gibt's ein Array namens Permissions. So kann dieses Array aussehen.

[00:03:32] - [Speaker 1]
Das erste

[00:03:35] - [Speaker 0]
ist https Doppelpunkt Schrägstrich Schrägstrich w w Punkt Google Punkt com. Das die nächste Erlaubnis ist Bookmarks, also Lesezeichen, Cookies, History, der Browserverlauf, Storage und Tabs. Das bedeutet, dass die Erweiterung eurer Lesezeichen lesen, manipulieren, verändern, löschen kann. Das Gleiche gilt für die Cookies und den Browserverlauf und andere weitere Informierte Erlaubnisse sind hier auch drin. Davon abgesehen ist die interessanteste Erlaubnis, nach der ich gesucht habe, die Hostzugang Erlaubnis.

[00:04:24] - [Speaker 0]
Das ist etwas, was definiert, auf welchen Domains eure Erweiterung laufen darf. In diesem Fall lass uns annehmen, dass wir die Erlaubnis für Google Punkt com gegeben haben. Das bedeutet also, dass die Erweiterung nur auf Google Punkt com laufen sollte und nicht einmal auf irgendwelchen Subdomains, zum Beispiel Developer oder Mail Punkt Google Punkt com. Das sehen wir auch in diesem winzigen Kasten, der uns sagt, dass die Erweiterung Inhalte auf WWW Punkt Google Punkt com lesen und ändern

[00:04:59] - [Speaker 1]
kann. Das

[00:05:05] - [Speaker 0]
diese Erweiterung wiederum erlaubt es uns, das auf Sternchen Punkt Google Punkt com zu machen, also allen Subdomains. Und die dritte Möglichkeit ist auch das Protokoll durch ein Sternchen zu ersetzen, was bedeutet also, dass das Protokoll HTTP, HTTPS oder auch FTP sein könnte. Abgesehen von diesen drei Erlaubnissen haben wir eine andere Möglichkeit, nämlich all Unterstrich URLs. Das bedeutet, dass die Erweiterung auf jeder Domain, die ihr besucht, JavaScript ausführen kann. Egal, ob das Google Punkt com oder Microsoft Punkt com oder wo auch immer ist, ihr könnt auf ziemlich jeder Domain Code ausführen.

[00:06:01] - [Speaker 0]
Aber es gibt ein paar Unterschiede mit dieser All URLs Erlaubnis. Sie kann nicht auf privilegierten Seiten laufen. Eine privilegierte Seite ist etwas, was irgendwelche sensiblen Einstellungen oder Browserdaten enthält. Zum Beispiel in Chrome gibt es Chrome Doppelpunkt zwei Schrägstriche Settings, da sind zum Beispiel Passwörter oder Kreditkarteninformationen drin. Und ihr könnt euch eine Situation vorstellen, wo die die Erweiterung JavaScript auf der Chrome Einstellungsseite ändern kann und dann könnte sie zum Beispiel Passwörter oder Kreditkarteninformationen klauen.

[00:06:48] - [Speaker 0]
In Edge eine ähnliche Seite, die ist About Doppelpunkt Flaggs.

[00:06:53] - [Speaker 1]
Hier

[00:06:57] - [Speaker 0]
seht ihr, dass sobald diese all URLs Erlaubnis zugeteilt wurde, dann kann es Inhalt auf allen Webseiten ändern. Wenn ihr den ersten Teil euch anschaut, dann seht ihr, dass es ein paar Möglichkeiten gibt, zum Beispiel Entwickler Features einzuschalten. Es hat auch ein paar Standardfeatures, zum Beispiel experimentelle JavaScriptfeatures. Lass uns mal schnell eine Erweiterung bauen. Wie schon gesagt, hat jede Erweiterung eine Manifest Punkt JSON Datei, die also alle diese Erlaubnisse und weitere Konfigurationen enthält.

[00:07:58] - [Speaker 0]
Die zweite Datei, die wir brauchen, ist Pop-up Punkt HTML. Das ist einfach das Interface unserer Browsererweiterung, also die Benutzeroberfläche. Sobald ihr eine Browsererweiterung anklickt, dann erscheint ein Pop-up Fenster, das euch möglich ermöglicht, irgendwelche Aktionen vorzunehmen. Das ist diese Pop-up Punkt HTML Datei. Und dann gibt es noch Pop-up Punkt js, das ist die das ist ein JavaScript, das also die Features dieser Extension ermöglicht.

[00:08:35] - [Speaker 0]
So sieht diese Erweiterung in Edge aus. Ihr seht ein winziges Microsoft Logo und sobald ihr darauf klickt, dann erscheint dieses Pop-up, das sagt, ich bin die böse Erweiterung. Und dann habe ich zwei Möglichkeiten. Die erste ist öffnen, die zweite ist execute, also ausführen. Sobald wir auf den Öffnen Button klicken, dann lädt es Google Punkt com im Browser.

[00:08:58] - [Speaker 0]
Und sobald ihr auf Execute, also ausführen klickt, dann erscheint dieses Alert Fenster mit einer eins darin. Das Interface ist also in Pop-up Punkt HTML geschrieben und sobald ihr auf Execute ausführen klickt, dann wird die Arbeit von Pop-up Punkt js erledigt. Lass uns schnell das Manifest Punkt Jason anschauen. Ihr stellt fest, dass ihr die dass ihr das Permissions Array in Zeile zehn habt. Das ist es enthält https WWW Punkt Google Punkt com Schrägstrich Sternchen.

[00:09:35] - [Speaker 0]
Das heißt, diese Erweiterung sollte nur auf WWW Punkt Google Punkt com ausgeführt werden, nicht einmal auf den Subdomains. Und so sieht die Pop-up Punkt HTML aus. Das ist einfach eine einfache HTML Datei mit zwei Buttons öffnen und ausführen. Und am Schluss liegt die Pop-up Punkt js Datei. Und die sieht so aus.

[00:09:56] - [Speaker 0]
Die ist auch sehr kurz. Sobald ihr auf den Open Knopf drückt, dann öffnet sie Google Punkt com und sobald ihr auf Execute ausführen klickt, dann öffnet sich ein Alert Fenster mit der Domain des Dokumentes. Diese Erweiterungen haben so viele Schnittstellen, zum Beispiel eine mit der für den Browserverlauf oder die Tabs. Aber die Tabs API fand ich so interessant, weil sie es euch ermöglicht, mit verschiedenen Tabs zu spielen. Zum Beispiel hat sie Methoden wie Tagespunkt Create, die euch also erlaubt, ein neues Tab mit einer beliebigen Domain zu erstellen.

[00:10:46] - [Speaker 0]
Auch Tagespunkt Update, die euch ermöglicht, die eine Seite zu einer anderen URL zu umzuleiten. Und Tagespunkt Duplicate ist auch wichtig, weil sie euch erlaubt, ein schon geöffnetes Tab zu duplizieren. Tabus Punkt Excute Script erlaubt euch, ein beliebiges Skript auszuführen und Tabus Punkt Hide und Tabus Punkt Reload sind relativ selbsterklärend und es gibt noch so viele andere Möglichkeiten. Von diesen waren für mich am interessantesten Create Update und Duplicate. Wenn wir zum Beispiel Bing Punkt com in einem neuen Tab mit einer Browser Extension laden wollen, dann braucht man einfach diese Part seinen Code, die also Browser Punkt Tabs create aufruft und ihm eine URL übergibt.

[00:11:45] - [Speaker 0]
Und diese URL ist WWW Punkt Bing Punkt com. Das ist Teil der Dokumentation und das ist für den Browser, also nicht für uns für jemanden mit meinen meiner bösen Vorstellungskraft war es interessant, rauszufinden, ob ich lokale URLs aufrufen kann. Also habe ich die Bing URL ersetzt durch eine durch einen lokalen Pfad, zu sehen, ob ich das Tab erstellen kann oder nicht. Und im nächsten Moment gibt mir Edge diesen schönen Fehler, der mir sagt, dass Edge die Seite nicht nicht erreichen kann. Und es sagt also, dass dies ein Relativpfad ist und also das ist das aus so einem als einen relativen Pfad verstanden hat und da es einfach an die URL der Erweiterung angehängt hat und deswegen bekommen wir diesen Fehler, weil natürlich diese Seite nicht existiert.

[00:12:52] - [Speaker 0]
Das ist eine andere Sache mit der Nein, das ist eine generelle Sache. Browsers sind sehr zögerlich, euch lokale Dateien laden zu lassen, weil ihr dann Daten exzentrieren könntet. Jetzt hier seht ihr zum Beispiel, ich versuche lokale Dateien mit JavaScript zu laden und jedes Mal sagt es, nein, das darfst du nicht, weil wir uns unsere weil wir unsere Nutzer schützen möchten. Weil wir das diese, weil wir rausgefunden haben, dass Browser Punkt Tabs Punkt Create für uns nicht funktioniert, habe ich mich als Nächstes für Browser Punkt Tabs Punkt Update interessiert. Das Gleiche habe ich mit Update probiert und da hat es irgendwie für mich funktioniert.

[00:13:41] - [Speaker 0]
Sobald ich das rausgefunden hatte, dass ich also lokale Dateien laden kann, wollte ich schauen, ob ich auch privilegierte Seiten aufrufen kann und auch das hat für mich super funktioniert. Hier seht ihr, dass ich, sobald ich auf den Open Knopf drücke, der Browser eine lokale Datei und auch eine privilegierte Seite für mich lädt. Das diesen Bug habe ich an Microsoft gesendet und sie haben mir schnell geantwortet. Und sie haben gesagt, wir unterstützen diese Download APIs. Das heißt, selbst wenn Du diese Seite aufrufen kannst, dann bringt es dir nichts, weil Du nichts damit tun kannst.

[00:14:24] - [Speaker 0]
Und wir werden das nicht wechseln. Und dann sagte ich, okay, lass es uns anders probieren. Im nächsten Augenblick kam ich auf die Idee, die JavaScript ein JavaScript UAI zu benutzen. Das ist eine UAI, die mit JavaScript Doppelpunkt beginnt. Das und anschließend kommt der JavaScript Code.

[00:14:46] - [Speaker 0]
Hier ist ein einfaches Beispiel dafür. Sobald der a href JavaScript Doppelpunkt alert one auf angeklickt wird, dann bekommst du ein Pop-up in deinem Browser. Das Gute an dieser an diesen UAIs ist, dass sie in der Hauptdomain ausgeführt wird und anders als lokale Dateien. Und Und das sehen wir in diesen Pop ups, weil weil die zweite das zweite Beispiel eine Null Domain hat und

[00:15:35] - [Speaker 1]
Wir sehen also, dass Browser hierstellten das safe machen wollten auf die Art und Weise. Also hab ich entschieden, dass JavaScript URIs keine gute Idee sind hierfür mit create, aber lass uns das doch mal mit Update versuchen. Also habe ich das mit Browser Tab create versucht. Das funktioniert für mich nicht. Und wieder, aber wir haben ja auch noch die Update Methode.

[00:16:09] - [Speaker 1]
Und benutzen halt die JavaScript URI. Und rufen JavaScript Doppelpunkt Alert Document Domain ein und das funktioniert. Und was ihr insbesondere in diesem Bild seht, ist, dass dieser Extension nur in der Lage sein sollte, auf Google com zu laufen. Wir haben sie aber auf Bing.com aufgerufen. Funktioniert, das ist nicht gut.

[00:16:37] - [Speaker 1]
Das ist eine totale Verletzung der Privatsphäre, denn die Nutzer*innen meinen an dieser Stelle, dass die Extension nur auf Google dot com laufen darf, tut sie aber nicht. Das haben wir reported zu Microsoft. Und habe euch also geschrieben beim letzten Mal hab ich gesagt, dass ich lokale Files mit Update laufen kann und ihr sagt, dass ihr das nicht fixen werdet. Jetzt kann ich Java Kürzel aufrufen. Okay, wir verstehen, was Du versuchst uns zu sagen.

[00:17:12] - [Speaker 1]
Kannst Du auch einfach User Cookies so alerten? Kannst Du sowieso insbesondere stehlen? Ja, okay, kann ich versuchen. Also versuchen wir einfach mal. Document Punkt Cookie.

[00:17:32] - [Speaker 1]
Da wir jetzt son einen haben, wie ich heut grade vorgeführt habe in Edge, können wir Facebook Daten oder all so was exportieren. Jetzt nehmen wir also mal an, wir fangen an bei Google E-Mails. Suchen haben etwa eine geheime E-Mail und die spricht von einem Coupon für tausend Dollar Cashback auf PayPal. Das zu diese Attacke zu demonstrieren, seht ihr, benutze ich Browser Tab Update. Und das suchst ich jetzt eine E-Mail mit einer bestimmten ID.

[00:18:10] - [Speaker 1]
Und die schicken wir an Leak dot html. Und was macht Leak html? Das kopiert sich, womit es im Curric String aufgerufen wird und schreibt es ins Dokument. Wenn wir also jetzt diese Extension auf Mail dot Google dot com öffnen, wird es diese Information stehlen. Dieses Proof of Konzept haben wir an Microsoft geschickt.

[00:18:43] - [Speaker 1]
Dasselbe auch wieder mit den lokalen Dateien. Das funktioniert nicht nur mit den falschen Domänen. Schauen wir noch mal, was mit lokalen Dateien passiert. So. Haben wir auch wieder reportet.

[00:18:59] - [Speaker 1]
Erinnert euch also noch mal, wie war das damit, dass wir lokale Dateien laden können? Das hat Microsoft nicht besonders interessiert, denn die Download APIs ja nicht unterstützt. Jetzt haben wir auch noch JavaScript Codeausführung bei lokalen Dateien. Und wenn wir diese beiden Bugs jetzt verketten, dann sollten wir damit auch lokale Dateien stehlen können. Was wir also tun, ist wieder Browser Tabs Update mit der Fire URL.

[00:19:24] - [Speaker 1]
Und hängen außerdem eine Browser Tabs Update Funktion an, die eine JavaScript URL anfragt. Was passiert jetzt? Bislang haben wir JavaScript Ausführungen und lokale Zugriff auf lokale Dateien. Was passiert jetzt? Das Nächste, was mir einfiel, ist privilegierte Seiten anzusehen, wie ich euch schon gezeigt habe, about flags und about compat und so.

[00:20:02] - [Speaker 1]
Also war ich relativ aufgeregt, ob das auf den privilegierten Seiten auch funktionieren wird. Also schauen wir mal nach about. Flags. Versuchen JavaScript Alert auf about. Flags.

[00:20:13] - [Speaker 1]
Zu meiner Überraschung hat das nicht funktioniert. Und ich hab ich war so überrascht, als ich den Kopf geschüttelt hab, was ist denn hier falsch? Dann wollte ich rauskriegen, was ist falsch mit dieser Implementation? Vielleicht gibt es Fehler in der Konsole. Also hab ich hier in der Konsole geguckt, was ist da los?

[00:20:37] - [Speaker 1]
Und dann seht ihr, gibt es keine passenden Fehler dafür. Ihr seht also diese sensiblen Seiten in Edge Chrome Firefox. Das sollte keine JavaScript Execution überhaupt zu sehen sein. Ja, das war Setzer. Warum funktioniert also diese Schwarzmagnet nicht auf den privilegierten Seiten?

[00:21:05] - [Speaker 1]
Selbst ohne CSP Fehler. Vielleicht ist Edge ja doch clever. Haben wir irgendeinen anderen Weg About of Flags zu laden? Das Nächste, was mir eingefallen ist, ist das RIS Protokoll. Das ist etwa, Ressourcen zu laden von Modulen.

[00:21:30] - [Speaker 1]
Also etwa Start About Flags könnt ihr hier RES Doppelpunkt v Slash forward Slash at html Punkt DLL forward Slash flags html aufrufen. Und plötzlich funktioniert es. Auf diese Art haben wir jetzt JavaScript ausführbarkeit auf diesen privilegierten Seiten. Das ist ziemlich schlecht.

[00:22:00] - [Speaker 0]
Denn

[00:22:03] - [Speaker 1]
damit können wir jetzt den Adobe Flash Player an- und ausschalten. Und andere Dinge, die wir skizziert haben, funktionieren hier halt jetzt auch. Wir nehmen also jetzt hier Browser Test Update, machen das HTML DLL Flags. Und machen jetzt unseren JavaScript URI Call in Browser Tabs Update. Und setzen damit aktivieren damit den Adobe Flash Player.

[00:22:38] - [Speaker 1]
Was ist jetzt das nächste? Das war mir schon genug. Aber ich wollte noch rauskriegen, ob wir noch mehr können. Dann hab ich jetzt weitergemacht mit dem Lesemodus von Edge. Das ist ein Feature in Edge, was eine Seite so rändert, dass sie einfach zu lesen ist.

[00:23:02] - [Speaker 1]
Das heißt, Edge entfernt all den Code, der beim Lesen hinderlich sein könnte, unnötigen Code für JavaScript iFrames und so fort. Man kann also... Also wir erwarten insbesondere, dass wir damit keine Werbung kriegen. Und der Browser sorgt dafür, dass kein JavaScript ausgeführt wird in diesem Modus. Du kannst...

[00:23:38] - [Speaker 1]
Insbesondere können wir den Browser nicht möglichst nicht mehr identifizieren nach Spezifikationen, wenn sie über die URL aufgerufen wurde von der Seite aus. Und man kann jede Webseite zwingen, so geladen zu werden, indem wir mit Read Doppelpunkt vor der URL starten. Weil der Reading Mode mit einem bestimmten CSP geschützt wurde, wurde damit diese JavaScript Execution geblockt. Das heißt, mal fühlte sich das safe an gegen JavaScript execution für den Testfall. Ja, ich hatte das auch weiterhin versalf.

[00:24:27] - [Speaker 1]
Ich habe das nicht reduzieren können darin, das ausführen zu können. Stellen wir uns vor, Wo eine Erweiterung andere Erweiterungen ausschalten könnte. Wir sind jetzt auf der internen Seite von Adblock Plus. Und wenn wir jetzt versuchen, unsere böse Erweiterungen zu umzuladen, haben wir weiterhin diese CSP Fehler. Also ja, auch safe.

[00:25:06] - [Speaker 1]
Wie problemisieren wir also mit? Also der die Host Permission Umgehung funktioniert also in diesem Fall nicht, wenn's nicht Inline Scripts zulässt. Aber was, wenn wir direkt versuchen mit Execute mit der Executecript API zu arbeiten? Nehmen wir also an, wir sind auf einer Seite, wo die CSP ordentlich implementiert ist, aber auch Host Zugriffserlaubnisse haben an derselben Stelle. Benutzen wir also hier Browser Tabs Execute Script mit dem PHP Script von oben.

[00:25:46] - [Speaker 1]
Mit Java. Die Erweiterungen mit so einem CSP funktionieren. Sie werden alles Mögliche an JavaScript zulassen, außer sie versuchen auf den wesentliche Veränderungen zu machen. In diesem Fall nehmen wir an, sind auf einer Seite, die ein gutes CSB hat, etwa so. Und jetzt versuchen wir aber, den DOM dieser bestimmten Seite zu verändern.

[00:26:29] - [Speaker 1]
Entweder können wir Document Write benutzen oder vielleicht Document dot Body dot NRHTML. Und was wir vielleicht noch tun können, ist ein Element generieren und darin schreiben. All diese Wege, den DOMTRY, den ja, den DOM Baum auf der Seite zu modifizieren, meist nicht erlaubt. Für die Erweiterung ist das allerdings irrelevant, ob wir den Dom ändern oder nicht auf einer solchen Seite.

[00:27:23] - [Speaker 0]
Viele dieser APIs sind noch nicht wirklich unterstützt, denn sie werden noch weiterentwickelt und Edge ist jetzt im Grunde auch Chrome basiert. Das heißt, es ist unklar, ob sie diese APIs weiter unterstützen werden, aber Active Tabs ist Active Tab ist eine der interessantesten Erlaubnisse, weil sie euch ermöglicht, beliebiges JavaScript auf der aktuellen Domain auszuführen. Das heißt, vielleicht können wir viele der diese Angriffe auf die Active Tab API oder Erlaubnis portieren. Die haben das in März zweitausendneunzehn mit der höchstmöglichen Bargeldbelohnung gefixt und die CVE Nummer ist CVE zweitausendneunzehn null sechs sieben acht. Danke für diesen interessanten Vortrag.

[00:28:23] - [Speaker 0]
Wenn ihr Fragen zum Vortrag habt, dann haben wir drei Mikrofone. Wenn ihr also Fragen habt, dann kommt bitte vor zu den Mikrofonen und wir beginnen mit Mikrofon Nummer drei. Für diesen interessanten Vortrag. Ich habe eine Frage. Ist dieser Bug oder ist die API auch relevant für den neuen Edge Browser, der im Januar kommt, der auf der Chromium auf der Chromium Brander basiert?

[00:28:57] - [Speaker 2]
Die neue Version läuft auf Chrome, aber Sie werden diese API nicht unterstützen. Aber Sie werden eine andere Methode dafür verwenden. Beantwortet das deine Frage?

[00:29:12] - [Speaker 0]
Ich hab mal eine zweite, wenn das in Ordnung ist. Und die zweite Frage ist, du hast versuchst versucht, die Seiten über das IAS Protokoll zu öffnen, aber die Funktionalität dieser Seiten, wird die auch von Edge gehandhabt und nicht vom About Protokoll?

[00:29:39] - [Speaker 2]
Ja, es funktioniert.

[00:00:50] - [Speaker 0]
Noch Fragen aus dem Publikum oder aus dem Internet? Dann noch eine noch einmal Applaus für Nikhil für einen großartigen Vortrag. Alors, à la présentation, casser les politiques de sécurité du Microsoft. Alors moi c'est et je vais vous guider dans cette recherche. Alors pour, avant de commencer cette présentation, je voudrais vous demander combien d'entre vous utilisent le navigateur, les de navigateur dans cette salle?

[00:01:10] - [Speaker 0]
Alors une extension de navigateur, c'est quelque chose qui étend les fonctionnalités des navigateurs. Alors on a des exemples typiques comme les bloqueurs de publicité, donc voilà qui bloquent les publicités sur certains sites comme YouTube et aussi des gestionnaires de mots de passe par exemple. Donc ces extensions peuvent gérer pas mal de vos données parce qu'ils peuvent gérer les les cookies, les mots de passe. Et donc ça veut dire qu'on doit juste mettre d'accord que ces extensions sont dangereuses puisque pouvoir gérer les cookies, les marques, les marques pages, et caetera. Alors par exemple une 1 extension assez comme Block plus sur Microsoft Edge, bon voilà c'est fait son job.

[00:02:13] - [Speaker 0]
Alors comment je fais pour savoir ce que cette extension est capable de faire dans mon navigateur? Par exemple, je regarde cette liste-là, alors elle a pas mal de permissions. Alors cette extension très simple peut lire, modifier le contenu, lire, modifier vos favoris, lire les sites que vous visitez, modifier tout ce que vous envoyez et recevez ou et lire tous vos, toutes vos données de navigation personnelle et envoyer des des notifications. Donc cette simple extension Adblock peut faire tout ça. Alors vous pourriez vous demander comment cette, ces permissions sont reconnues.

[00:03:06] - [Speaker 0]
Donc comment les navigateurs peuvent reconnaître d'où deviennent ces permissions? Alors il y un modèle de permissions dans les dans les extensions et donc on a ce fichier manifeste point json et dans ce fichier, il y a les permissions. Et donc dans ce tableau de permissions, petit exemple, vous voyez une URL https w w point Google point com, ensuite la permission Bookmarks, cookies, stories, et donc cette extension assez simple, elle les permissions de lire les marque-pages du cookie, elle peut les manipuler, elle peut en ajouter, les enlever et d'autres permissions importantes de même. Alors, à part ça, la permission la plus intéressante qu'hier et que je cherchais, c'est la permission d'accès à un hôte. Donc c'est quelque chose qui définit sur domaine l'extension de, l'extension peut se lancer.

[00:04:31] - [Speaker 0]
Alors par exemple, supposons qu'on ait afficté la permission à, point Google point com, alors cette extension peut se lancer uniquement sur Google point com et pas sur les sous-domaines. Par exemple mail point Google point com. Donc c'est ce qu'on définit dans cette petite boîte que cette extension peut lire ou modifier du contenu sur certains sites comme point Google point com. Donc ce qu'on peut aussi mettre comme type de parution, c'est étoile point Google point com, ce cas-là on couvre aussi les sous domaines. Et la 3e type de permission qu'on peut avoir, Et donc on peut mettre slash étoile 2 points slash slash étoile point g o point com et donc dans ce cas-là ça marche sur tous les protocoles par exemple FTP.

[00:05:31] - [Speaker 0]
À part ces 3 permissions, il y une autre qui existe qui est All URLs, donc cette permission est spéciale parce que ça veut dire que l'extension est affectée à toutes les URLs, elle donne le droit d'exécuter du code JavaScript sur tous les domaines, donc Google point com ou n'importe quoi d'autre, donc tous les domaines. Mais il y a quelques restrictions sur la permission All URL, c'est, elle ne peut pas se lancer sur les pages privilégiées. Alors une page privilégiée c'est une page dans le navigateur qui contient des données sensibles ou du navigateur. Donc par exemple les pages de paramètres qui contiennent les, donc ça c'est sur Chrome, on peut modifier les paramètres de cartes de crédit, et caetera. Dans ce cas-là on peut imaginer une situation où voilà, l'extension est capable d'écrire du du JavaScript sur un chat et puis en fait elle peut modifier tous les mots de passe et les informations de garde de crédit.

[00:06:48] - [Speaker 0]
Alors sur Edge, on a une permission, une page similaire,. Alors ici on peut voir cette, les extensions, une extension qui a ces permissions url, elle peut essentiellement tout modifier. Alors sur cette page, sur la 1re page, vous voyez qu'il y a un certain nombre de permissions importantes. Par exemple activer Adobe Flash player ou d'autres fonctionnalités et puis on peut avoir la consommation de mémoire restreinte pour les développeurs. On peut activer des des fonctionnalités expérimentales, JavaScript, et caetera.

[00:07:39] - [Speaker 0]
Donc vous voyez à quel point cette page contient des paramètres sensibles.

[00:07:47] - [Speaker 1]
Donc si on, comme je l'ai dit, une extension à un fichier manifeste point json qui liste notamment toutes les permissions et d'autres d'autres permissions. Donc un outil dont on a besoin c'est popup point HTML et dès qu'on clique sur une extension de navigateur, Et ensuite on a pop-up point j s qui contient seulement du JavaScript qui va effectuer des actions liées à ce qu'il veut dans pop-up pour HTML. Donc ça, c'est ce comment notre extension, c'est ce à quoi elle ressemblerait dans Edge. Donc dès qu'on clique sur le logo de l'extension, la pop-up va apparaître et afficher ce message avec 2 options, donc Open ou Exécute. Donc si on clique sur Open, ça va charger Google dot com dans le navigateur, alors que si on clique sur Exécute, ça va effectuer un alerte de un.

[00:09:08] - [Speaker 1]
Et du coup, le tout le travail est fait par popup point j s. Donc si on regarde la source du fichier manifeste point j o, ce qu'il faut remarquer c'est qu'on va pouvoir regarder les permissions à la ligne 10 qui sont, enfin ce qu'on voit ici c'est une entrée https 2 points slash s 3 w point Google point com slash étoile. Ça veut dire que l'extension devrait tourner seulement pour Google point com et pas sur les sous domaines. Donc voilà le code de pop-up point HTML, donc c'est un fichier HTML simple. On a 2 boutons, un qui est Open, l'autre qui est Exécute.

[00:09:51] - [Speaker 1]
On charge j s slash pop-up point j s et c'est tout. Et pour pop-up point j s, donc c'est très court aussi. Ce qu'il fait, c'est que lorsqu'on clique sur le bouton open, ça charge Google point com. Si on clique sur le bouton exécute, ça ça effectue une alerte sur le domaine du document grand. Donc il y a beaucoup d'API qu'on peut utiliser pour les pour les extensions navigateur.

[00:10:23] - [Speaker 1]
Donc par exemple l'API Tabs, l'API Proxy, donc moi l'intérêt, l'API Tabs pour moi elle est d'un intérêt particulier. Donc elles fournissent quelques fonctionnalités, par exemple, permet de créer un 1 nouveau un nouveau onglet. Et il y a également la fonctionnalité, enfin la fonction update, et la la méthode duplicate est aussi un 1 point important parce qu'elle va permettre de dupliquer un onglet déjà ouvert, donc comme on pourrait s'y attendre, elle permet d'exécuter du JavaScript, donc qui sont enfin qu'on comprend aussi dont on comprend aussi le le la signification et il y en a plein d'autres. Donc nous ce qui nous intéresse c'est et Donc voyons ce qui se passe si on veut charger bingdos com. Donc on va pouvoir faire ça en utilisant ce qui est affiché sur la slide.

[00:11:47] - [Speaker 1]
Donc, donc ça c'est c'est dans la c'est dans la documentation et c'est cette façon de faire elle est destinée aux gens bien et ce n'est pas exactement ce qu'on est. Donc qu'est-ce qui se passe si on utilise ça pour pour pour lire des fichiers locaux? Donc si on donne l'url d'un fichier local pour voir comment le le navigateur va essayer de l'ouvrir, donc juste après on a une erreur dans Edge qui dit, je ne peux pas, je ne peux pas ouvrir cette page, vérifier que vous avez la bonne adresse, et caetera. Donc globalement ça essaie d'ouvrir, enfin ça se fait des opérations sur l'extension et ça essaie de l'ouvrir et le fichier là, il n'a pas l'air d'exister donc ça résulte en une erreur. Donc c'est assez c'est assez général, ça va aussi fonctionner pour d'autres navigateurs qui ne pas vous permettre d'ouvrir de cette manière des fichiers locaux.

[00:13:08] - [Speaker 1]
Donc par exemple des erreurs qu'on va obtenir dans Edge ou dans Chrome, donc dans les 2 cas, ça ne va pas être possible, enfin le le, on va avoir un message d'erreur qui dit que ça ne pas être possible parce que on veut protéger l'utilisateur. Donc vu que la méthode create n'a pas fonctionné, on va, enfin on va essayer un peu quelque chose de similaire avec la méthode update. Donc on va réessayer de fournir une URL qui correspond à un fichier local et voir si ça fonctionne. Donc en fait ça fonctionne, et maintenant on va essayer de faire la même chose pour une page privilégiée. Et en fait ça fonctionne également.

[00:13:58] - [Speaker 1]
Donc comme on peut le voir, lorsqu'on clique sur le sur le bouton open, ça fonctionne et dans Edge on a a bien la page About qui s'ouvre. Donc quand j'ai signalé ça à Microsoft, ce qu'ils ont dit c'est que on n'a pas le support pour l'API de et du coup on ne va pas, on ne va pas spécialement s'intéresser à fixer ça. Donc ce que je me suis dit c'est qu'ensuite j'allais passer par du JavaScript. Donc ça, une syntaxe assez pratique, on peut utiliser cette syntaxe assez pratique. Donc ici dès qu'on trigger le le href, on va avoir alerte et on va effectivement avoir une 1 pop-up qui correspondra à cette alerte qui qui qui apparaît.

[00:15:04] - [Speaker 1]
Donc ça ça s'exécute en référence au domaine principal, pas comme pour les url tout à l'heure. Donc on peut voir ici que le domaine affiché, ce n'est pas le même à gauche et à droite. Donc, les les les vendeurs de navigateurs ont décidé de de rendre ça safe. Donc du coup on va poursuivre un petit peu sur sur javascript et sur les, en essayant de bypasser les permissions. Donc si on essaie d'ouvrir un fichier, un tab avec Create to Open et en utilisant une url en JavaScript, ça ne va pas fonctionner.

[00:16:09] - [Speaker 1]
Mais si on essaie avec la méthode update et qu'à nouveau on fournit une URL sous la forme d'une URL JavaScript avec un alerte du de document point domaine, alors cette fois ça fonctionne. Donc on le, on peut voir à l'écran que l'url devrait afficher, enfin permet de de changer le, enfin de de lire le contenu de de Google point com alors que le site affiche plutôt le domaine bing point com. Le l'utilisateur va croire que ça ne devrait pas fonctionner sur d'autres domaines que Google point com. Donc à nouveau ça ça a été, enfin Microsoft a été informé, mais ils ont dit on ne va pas corriger ça, même si maintenant on a des équations de code de javascript également. Ils ont dit, on comprend ce que vous essayez de dire, mais par exemple est-ce que ça fonctionnerait également en essayant de de faire des alertes sur les cookies, de voler les les cookies d'un utilisateur?

[00:17:26] - [Speaker 1]
Donc vu que, on a, on a un bail pass des hausses permissions sur Edge, on va pouvoir voler des mails Google ou de la donnée qui vient de Facebook ou n'importe quoi d'autre. Donc par exemple supposons qu'on a un mail sur Gmail qui dit qu'on a qu'on a un coupon de réduction pour pour du cashback sur PayPal avec le code de qui correspond au coupon. Donc ici on utilise, on utilise la méthode de l'API de saps.

[00:18:02] - [Speaker 0]
Donc

[00:18:04] - [Speaker 1]
on va récupérer un email avec un I un avec un I d particulier. Ouvrir point html, et appeler point html. Donc, quand on clique sur le bouton open, ça va récupérer le le mail que l'on ciblait, celui avec l'ID qu'on a fourni. Donc ce POC a été envoyé à Microsoft.

[00:18:40] - [Speaker 0]
Et

[00:18:46] - [Speaker 1]
la même chose pour les fichiers locaux aussi. Et donc dans ce cas donc ça a fonctionné aussi. Donc si vous vous rappelez, avant quand on a travaillé sur les fichiers locaux, Microsoft a dit on ne va pas fixer ça parce qu'on ne supporte pas l'API de download. Et maintenant on a aussi la code d'exécution sur javascript sur les fichiers locaux. Donc on peut combiner tout ça pour voler des fichiers locaux.

[00:19:25] - [Speaker 1]
Donc ici on va avoir d'une part d'une part un sur un fichier local et un sur une javascript. Donc qu'est-ce qu'on fait ensuite?

[00:19:43] - [Speaker 0]
Donc on a de l'exécution sur les autres domaines, on a de contournement des privilèges. Alors, ce qu'on va essayer maintenant c'est, vous reparler des pages privilégiées. Alors, j'étais tellement excité que ça marchait sur les pages privilégiées, et donc j'en sais encore essayer ce, ce, d'écrire ce petit morceau de code et je l'ai essayé sur About Flags. Bizarrement en fait ça ne marchait pas pour moi et j'étais plutôt surpris, je me suis dit mais pourquoi? Et ensuite, donc j'essaie de comprendre pourquoi ça ne marchait pas avec cette implémentation-là, pourquoi ça ne marchait pas et pourquoi il y eu peut-être des alertes dans la console donc j'ai ouvert la console pour voir et en fait ce que vous voyez c'est qu'il n'y pas du tout ces alertes.

[00:20:39] - [Speaker 0]
Et la raison c'est que ces pages sensibles du navigateur comme Chrome Firefox et même Edge, en fait ils utilisent du du CSRP pour éviter qu'il y ait de l'exécution de javascript et en fait vous ne pouvez pas avoir ces alertes sur ces pages. Et alors, il me dit mais qu'est-ce c'est que cette magie noire qui fait qu'il ne marche pas sur les pages privilégiées puisqu'on n'a pas des erreurs CSP. Donc peut-être que cette fois Edge est plus intelligent ou peut-être qu'en fait il y a une autre façon de lire sur Edge. Et alors ce que je me suis dit ensuite c'est, mais on va utiliser le protocole RES. Alors le protocole RES il permet de lire des ressources depuis certains modules, donc par exemple c'est RES 2 point slash slash Edge html point DLL slash flags point htm.

[00:21:37] - [Speaker 0]
Et, et c'est là qu'on se rend compte que ça marche. Alors de cette façon-là, on a réussi à obtenir l'exécution de code JavaScript sur les pages privilégiées, ce qui est quand même assez mauvais. Donc maintenant qu'on a l'exécution sur une page privilégiée, on peut activer désactiver le, le flash player. Donc, donc on peut le faire exactement de la même manière. Donc, donc ce que je faire c'est, je vais encore appeler point point, le faire pointer vers vers l'url en reste 2 points slash slash flag point HTM, et ensuite j'utilise une url javascript pour activer le lecteur flash.

[00:22:38] - [Speaker 0]
Qu'est-ce qu'on peut faire ensuite? Alors bon, c'était plutôt déjà pas mal pour moi mais comme chaque fois je me suis demandé, on peut-être faire encore autre chose et alors j'ai, je me suis dit on va regarder le mode lecture de Edge. Donc c'est une feature qui est implémentée dans Edge et qui permet de faire le rendu d'une page d'une manière qui est plus facile à lire. Donc pendant le rendu, on va enlever tout le, le code, JavaScript, et caetera Et en fait, ça permet de fournir une page simplifiée à l'utilisateur et, et donc pour ça on, on enlève toutes les exécutions de code JavaScript dans le mode lecture. Et du coup, on ne peut pas mettre n'importe quel document en mode lecture, il faut que, que Edge arrive à repérer la compatibilité.

[00:23:42] - [Speaker 0]
Mais, donc, donc si on a une URL qui pointe vers un domaine particulier, on peut lire, récupérer des ressources. Alors bon, j'essayais de faire la même chose mais apparemment le mode lecture était protégé par une sorte de CSP et donc il n'autorise pas les les scripts inline et donc c'était bloqué. Bon, je, je n'ai pas réussi à aller plus loin, donc bon, jusqu'ici le mode lecture avait l'air pas mal. Alors, on peut essayer d'utiliser de l'exécution de code JavaScript sur d'autres pages, et notamment les pages qui sont définies à l'intérieur d'autres extensions donc par exemple est-ce qu'une extension peut quelque chose qui est dans une autre extension? Et, et donc si on va sur les pages internes d'autres extensions, on revoit encore cette même erreur Cfp qui empêche d'exécuter du code JavaScript.

[00:25:01] - [Speaker 0]
Donc les privilèges de CSP, veut regarder, si on peut utiliser l'API Exécute Script directement pour voir si ça permettrait de contourner le CSP sur ces, sur ces pages. Puisque, alors, donc là vous pouvez, vous pouvez avoir le code, donc avec la politique de sécurité de contenu, qui est réglée à self, et on refait Browser point tab point execut script, et puis du code qui est simple alerte sur le domaine du document. Et la façon dont les extensions gèrent le CSP, alors en fait les navigateurs autorisent le JavaScript dans toutes les extensions sauf si elles essayent de travailler le, de changer le dôme d'un, d'une page particulière. Donc là par exemple, si, bon, supposons qu'on est sur une page qui est tout à fait avec tout à fait avec le CSP et on essaye de changer le dom pour cette page. Alors par exemple on peut utiliser document point write ou document point body point inner html égal un peu de code javascript, et une autre façon de faire c'est de générer un élément et écrire dedans.

[00:26:44] - [Speaker 0]
Et toutes ces techniques permettent de manipuler l'arbre du dôme d'une, d'une page protégée par le CSP, ça c'était pas du tout autorisé ni par Firefox ni par Chrome, mais en fait c'était pas protégé à l'intérieur d'Edge et donc le script comme ça pouvait exécuter n'importe quel code JavaScript sur n'importe quel domaine même si le CSP était en place sur cette page. Alors en conclusion, alors les extensions Edge sont encore encore de développement, toutes les API sont pas encore supportées, parce que donc, est basé sur une base d'utilisateurs premium, donc est-ce qu'ils sont encore en train de développer des extensions? On sait pas trop, mais Active Tap c'est que ça reste l'une des permissions les plus intéressantes puisque ça permet d'exécuter du code JavaScript sur le domaine courant. Et bon, ça permet de lancer la même attaque sur, sur cet api. Alors Microsoft a enfin décidé de corriger le bug en, avec la mise à jour de mars 2019, avec la plus grosse récompense possible donc c'est le CVE 2019 0 6 7 8.

[00:28:19] - [Speaker 0]
Merci pour ce, cette présentation intéressante. Si vous avez des questions, a 3 micros, 1 2 3 et si vous avez une question, venez au micro, micro numéro 3. Bonjour,

[00:28:33] - [Speaker 1]
merci pour cette présentation intéressante. Donc j'ai une question. Est-ce que cette API, enfin vous avez trouvé ça aussi pertinent pour l'API qui vient sur Chromium prochainement? Donc la réponse est, vu que la nouvelle version de Edge tourne, enfin est basée sur Chromium, Donc ils utilisent d'autres conventions d'appel et du coup j'ai une j'ai une 2e question. Donc vous avez essayé d'ouvrir les les pages avec le protocole R0S.

[00:29:33] - [Speaker 1]
Mais est-ce qu'on ne peut pas faire la, à peu près la même chose avec le protocole? Et la réponse c'est, oui ça va aussi fonctionner. Ok, applaudissez notre speaker.

[00:00:19] - [Speaker 0]
Our next speaker works as a security consultant at Payatu Software Labs and he loves finding security flaws in the Microsoft Edge browser and incidentally this is the topic for this next talk. So please give a big round of applause to Nikhil Mittal.

[00:00:42] - [Speaker 1]
So welcome to the talk breaking Microsoft Edge Extension Security Policies. My name is Nikhil. I work at Payadoo Labs, and I'm into web and browser one hundred thirty research. So to start with this presentation, I would like to know how many of you uses browser extensions in general? Like, oh, nice.

[00:01:07] - [Speaker 1]
So many hands. Okay. So a browser extension is something that extends the functionality of your web browsers. We have typical examples like AdBlockPlus, which I think most of the people use this to block the ads on some certain sites like YouTube, and Grammarly, and some sort of password managers as well. So these extensions are capable of managing most of your data because they can handle the cookies, bookmarks, storage, passwords, history, and whatnot.

[00:01:43] - [Speaker 1]
So that being said, we all have to agree on a point that these extensions are powerful because they can deal with your cookies, bookmarks, and other sensitive information in the browsers. So here's how simple AdBlock Plus extension looks like on Microsoft Edge, which is pretty much doing its job. Now have you ever tried to figure out what this extension is capable of doing in your browser? Oh, nice. So if you look at the settings, here we have a couple of permissions, which I've listed down on the next slide.

[00:02:24] - [Speaker 1]
So a simple AdBlock Plus extension can read and change content on websites that you visit. It can read and change your favorites. It can see the websites you visit. It can read and change anything you send or receive, and it can also store personal browsing data on your browser, and it can also display notifications as well. So there are so many things a simple AdBlockPlus extension can able to do in your browser.

[00:02:53] - [Speaker 1]
So so you might ask like, how browsers recognize these permissions? Like, a extension is able to do is able to do so many things in my browser, but how does browser recognize, like, where are these permissions coming from? So here's a permission model in browser browser extensions. So under the source of every extensions, we have a file called as manifest dot JSON. And inside the manifest dot JSON file, we have a permission array.

[00:03:27] - [Speaker 1]
So here's a quick example of a permission array where we have some permissions. So the first one is https, WWW dot Google dot com, which we'll see right after this slide. The next permission we have is bookmark, and cookies, history, storage, and tabs. So let's suppose a extension has permissions with the bookmark and cookies, so that means that extension can handle your bookmarks. It can manipulate them, it can edit them, it can remove them, and whatnot.

[00:04:00] - [Speaker 1]
So the same goes with the cookies history as well, and there are other important permissions as well available for the browsers. So apart from these permissions, the most interesting permission that I was looking for is the host access permissions. So a host access permission is something that defines on which certain domains your browser extensions should be able to run. So in this case, let's suppose we have assigned permissions to http WWW dot Google dot com. So that means this extension should be able to run on Google dot com only, not even the sub domain.

[00:04:42] - [Speaker 1]
That is developer dot Google dot com or mail dot Google dot com. So this you can also verify with a tiny box that says, this is allowed to read and change content on some sites, WWW dot Google dot com. Now, the second permission we could have in this here is http asterisk dot Google dot com. So basically, this also covers the sub domains as well. And the third possible permission we can have is asterisk colon slash slash asterisk dot Google dot com.

[00:05:15] - [Speaker 1]
So basically, this says now not only I'll work on Google dot com, but basically on all the protocols as well, which is HTTP, HTTPS, might be FTP. That belongs to the particular domain. So apart from these three permissions, we have the another permission in the row, which is all underscore URLs. This permission is so special because once a browser extension is assigned to all URL, all underscore URL permissions, that can execute JavaScript code on every domain that you visit. So let's suppose you are on Google dot com or maybe you're on bing dot com or anything else, it will work on most probably on every domain.

[00:05:59] - [Speaker 1]
But there are a few restrictions with the all underscore ULS permissions. That is, it cannot run on privileged pages. So a privileged page in browser is something that contains some sort of sensitive settings in your browser data. So you might share of Chrome slash settings, which contains the password manager for Chrome, and also you can identify the credit card and debit card information on Chrome slash settings as well. So you can imagine a situation.

[00:06:33] - [Speaker 1]
Once the extension is able to run a JavaScript code on Chrome settings page, then it can probably read or it can steal all of your passwords and credit credit and debit card informations as well. So on the edge, we have a similar page, which is about dot flex. So here you can see once extension with all underscore URL permission is assigned, it can read and change content on website you visit as per the edge. So here's a quick snap of about dot flags and edge. And so if you look at the first part, you will figure out there are a few important permissions, like you can enable Adobe Flash Player, you can also enable developer features, and also you can enable and disable, allow undistricted memory consumption for the web pages as well.

[00:07:27] - [Speaker 1]
And it also has some standard preview features, like you can enable, disable some experimental JavaScript features as well. So now you can imagine the sensitivity of this page contains. Okay. So let's build a quick... Let's quickly build extensions, so that will break most of the things in Edge.

[00:07:47] - [Speaker 1]
So as I said, every extension has a manifest dot JSON file, which has all the permission and other configurations. The second file that we will be needing is popup dot HTML. So popup. Html is nothing, but it's just an interface for the browser extension. So basically, you might have noticed, as soon as you click on any of the browser extension, a popup appears on your window that contains some sort of functions.

[00:08:16] - [Speaker 1]
That is nothing but just a pop up dot HTML file. And then again, we have a pop up dot JS, which has all the JavaScript code that executes according to the actions chosen by the pop up dot HTML. So this is how our extension should have looked on the edge. So you have seen a tiny Microsoft logo, and as soon as you click on it, pop up will appear. It says, I'm the evil extension.

[00:08:45] - [Speaker 1]
And I have two options. The first one is open. The second one is execute. So as soon as you click on the open button, what it does is it will load Google dot com on the browser. And as soon as you click on the execute button, it will just alert one for you.

[00:09:01] - [Speaker 1]
So basically, the interface is written in popup dot html. And again, as soon as you click on execute, so the work is done by popup dot js. So let's quickly look at the source code for the manifest dot json file. The thing to notice here is that you can figure out the permissions, permission array on line number ten, which is set to http colon slash slash w w dot Google dot com. That means it's clear that this extension should be able to run on Google dot com only.

[00:09:35] - [Speaker 1]
I mean, not on the sub domains even. So as a source code for the popup dot html, which is just a simple HTML file that has two buttons. The first one is open, the second one is execute, and it has a popup dot j s at the end. So here we have the popup dot j s. So in very brief manner, what it does is, as soon as you click on the open button, it loads Google dot com.

[00:10:02] - [Speaker 1]
And as soon as you click on the execute button, it calls the JavaScript. It alerts documented domain for you. So there are so many APIs available for the browser extensions that you can use like history API and some sort of proxies API, tabs API. But for me, this tabs API was so interesting because it allows you to play with different tabs. Like, it has some it has some function methods inside, like tabs dot create.

[00:10:38] - [Speaker 1]
So what it does is, it allows you to create a new tab with any arbitrary domain, and it also has tabs dot update. And what it does is it allows you to update the update the page with the next URI. And tabs dot duplicate is also important because it allows you to make an exact replica of an already open tab. The next permission... The next method is tabs dot execute script.

[00:11:03] - [Speaker 1]
So this is pretty simple. This allow... This has allowed you to execute JavaScript code. And tabs dot hide and tabs dot relate, which is pretty easy. So, and there are so many other methods as well.

[00:11:16] - [Speaker 1]
So out of them, the most interesting one for me was create an update and also the duplicate method. So let's see if you want to load a new, so let's see if you want to load bing dot com on a new tab using a browser extension. So you can just write these five lines of code that calls browser. Tabs. Create, and then it passes a URL, which is https:w w w dot Google dot com.

[00:11:45] - [Speaker 1]
So this is as per the documentation, and this is for the good boys, like not for us. So as an evil mind, like, I was interesting to know, like, what would happen if I try to load local files instead of a normal domain. So then I replaced the Bing URL with a particular local file URI to try to figure out, like, how browser will treat it. Will it open it or not? So the next moment, Edge gives me this nice error like, okay, I can't reach this page.

[00:12:21] - [Speaker 1]
And you make sure you have got the right web address. That is m s hyphen browser hyphen extension, and then the path for the extension, and it appends the file you are a path in the last. So basically, it assumes that this is a relative path, and I'm going to add it with the extension path, and I'm going to open it. So since that particular part doesn't exist, it gives us an error. So this is not a thing with the extension as well, but this is in general.

[00:12:55] - [Speaker 1]
Like any of the browser, they don't allow you to load local files at any cost because this might lead an issue to steal your local system's files. So you can see the image in the Edge and Chrome browsers. So here I'm trying to load local files using the JavaScript. So every time it says, okay, we are not allowed to do that because we care about our users and we will protect them. So since we figured out this browser dot tabs dot create method was not working for us, the next method that I was looking for the update.

[00:13:33] - [Speaker 1]
So I tried the same thing with the update method, and somehow it worked for me. So next, once I was... Once I figured out, okay, now I can load the local files, now I want to load the privileged pages because they are also interesting for me and it was also working fine for me at the moment. So here you can see, as soon as you click on the open button, browser loads a local file for me and also a privileged page on edge. So I reported this bug to Microsoft, and they quickly responded back to me saying, we don't support download APIs, so even if you load the local files, you have no way to steal it.

[00:14:18] - [Speaker 1]
Like, you literally cannot do anything by loading the local files, and we are not going to fix it. So I said, okay, let's do it another way. So the next moment the idea came to my mind is to use the JavaScript URI. A JavaScript URI is something that start with the JavaScript protocol. It has a particular syntax, like first JavaScript, and then colon, and then the JavaScript code.

[00:14:44] - [Speaker 1]
Here we have simple examples, like as soon as the Ahref, Javascript colon alert one, it gets rendered in the browser, and you click on the test, a Javascript code will pop up on your browser. So the good thing about the Javascript URI is that they execute in the main domain's reference, unlike the data URIs. So you can look into the image, we have JavaScript URI, and the data URIs as well, that points to alert document domain. And one JavaScript URI says, I'm on HTML editor dot square feet dot com, while the data URI said the null domain. So basically, the data URIs was supposed to execute on the main domain's reference a couple of years back, but then it creates a lot of mess with the browser.

[00:15:32] - [Speaker 1]
So browser vendors, they decided to execute the null domain reference just to make it too safe. So at this point of time, I decided, okay, JavaScript URIs are like the best candidate for us, so why not to try it? So I've tried the same JavaScript URI with browser. Types. Create, and again, it doesn't work for me.

[00:16:03] - [Speaker 1]
But again, we have a friend or called update method, and I've tried the same thing with the JavaScript URI that points to browser dot tabs dot update, which again calls JavaScript colon alert, document or domain, and it worked for me this time. So you can figure out with this picture, this extension should have able to run on Google dot com, and now we are on a bing dot com. And if you click on the open button, we have a JavaScript code execution on Bing dot com. Like, this is how bad it was. Because that's a total violation of the privacy because the user believes that this extension shouldn't able to run on the other domain, expect the Google dot com.

[00:16:48] - [Speaker 1]
So this was again reported to the Microsoft saying, okay, so in the last time I reported like I'm able to load the local files, but you said I'm not going to fix it. And now we have a JavaScript code execution as well. So then again, they said, okay, like we got your concern. We understand what we understood what you're trying to say, but can you also alert users cookies as well? Like is it possible to steal the users cookies?

[00:17:16] - [Speaker 1]
Then I say, okay, why not? So instead of document or domain, you can just use document or cookie to pop up users cookies as well. So since we have host access permission bypass on edge, so we can steal Google emails, even Facebook data, or anything like that. So to demonstrate this attack, let's suppose we have a simple Google email which says, I'm a secret email and I have some coupon code for thousand dollar cashback, and there we have some random coupon code. So to demonstrate this attack, you can see I'm using browser dot tabs dot update that points to a certain JavaScript URI.

[00:18:01] - [Speaker 1]
And what it does is it create... It fetches the particular email with with a particular ID, and opens a new tab, and send it to the leak dot HTML. And further, what leak dot HTML does is it copies the value from location dot hash, and write it onto the page. So as soon as you click on the open button, if you are on mail dot Google dot com, it will steal the particular email and display it back on the attacker's domain. So this is how I was able to steal the Google emails.

[00:18:35] - [Speaker 1]
So this proof of concept was sent to the Microsoft, and the same thing with the local files as well. Like, I thought, okay, now it's working for the domain. Now what if we try with same thing with the local files as well? So yeah, in this case, it worked as well. So if you remember, in the past when we were able to load local files but Microsoft says, okay, we are not going to fix it because we don't support download API.

[00:19:04] - [Speaker 1]
And now we have a JavaScript code execution on local files as well, so we can chain both of these bugs to steal the local files as well. So as a simple proof of concept, so at the first, what we are doing is browser. Types. Update, that points to a file URI. And again, browser.

[00:19:24] - [Speaker 1]
Types. Update, that points to a JavaScript URI. So Microsoft was like, okay, now we have to fix. But what is next? So so far we have JavaScript code execution on local files.

[00:19:41] - [Speaker 1]
We also have host access permission bypass. Now what is next? So the next thing that came to my mind is always the privileged pages, as I already explained the sensitivity of the privileged pages. So so the next moment I was so excited that this will work on the privileged pages as well. So again, I wrote this five line of code and tried to execute in reference to our dot flex.

[00:20:09] - [Speaker 1]
And surprisingly, it wasn't it wasn't working for me. And I was so surprised like why this is not working and like shaking my head, like, what is wrong? So the next moment, I was trying to figure out what is wrong with this implementation, like why it is not working. Maybe there are some errors in the console, so I tried to open the developer console to figure out the possible errors. But you can see there is no such errors at all.

[00:20:36] - [Speaker 1]
So the reason for that is most of the pages, like the sensitive pages in the browsers like Chrome, Firefox, and even on the edge, are protected with the CSP to make sure there shouldn't be any JavaScript code execution. But we cannot see any CSP errors here as well, which was pretty strange for me. So then again, I asked to myself, like, why this Blackmagic is not working on privileged pages? Even when we don't have the CSP error, maybe this time Edge is playing smart. Or do we have any other way to load about load flags in Edge?

[00:21:16] - [Speaker 1]
Then the next idea that came to my mind is to use the res protocol. So res protocol is something that is used to fetch some sort of enough resources from a module. So instead of about dot flags, we can call res colon slash slash age HTML dot dll slash flag dot htm. And the next moment, it worked. So this way we have now JavaScript code execution on privileged pages as well, which is pretty bad.

[00:21:55] - [Speaker 1]
So once you have JavaScript code execution on privileged pages, you can enable and disable Adobe Flash Player. And there are other method which we have other possible options which we have already discussed can also be possible with the same thing. So again, what we need to do is to call browser dot tabs dot update that points to HTML dot dll slash flags dot htm. And again, a file, again, some sort of JavaScript URI to fetch get element by ID and then click on it so it will toggle the other Flash Player setting on the edge. Again, what is next?

[00:22:38] - [Speaker 1]
So this was pretty enough for me, but again, like I was trying to figure out if we can do something else as well. And then I start with the reading mode. So a reading mode is a feature implemented in Edge which renders a page in a way that is like kind of pretty easy to read. So in this process, Edge makes sure that there shouldn't be any JavaScript code execution on the page. The main purpose for reading mode is that to provide the users, to provide a simplified page to the users.

[00:23:13] - [Speaker 1]
So basically, there should not be any advertisement or something like that. So for that reason, browser vendors, they make sure there shouldn't be any JavaScript code execution on reading mode. And there was one bug with the reading mode as well, like you cannot put any document in the reader mode until unless browser identified it, identified its complete... Complete... You can append the read colon protocol in the in the first, and then the URL that points to some certain of domain, and then Edge will load the particular resources in the reading mode as well.

[00:23:50] - [Speaker 1]
So fortunately, I've tried the same attack on the reading mode as well, but since the reading mode was protected with a certain CSP, and then so you can see the CSP error, which says we do not allow inline script, and it will be blocked by the edge. So reading mode was kind of safe, at least for the test cases, but in some certain test cases, it worked for me, but I was not able to reproduce it further, so that's why I marked it as safe. The other possible features we can have is the JavaScript code execution on other extension pages. Like again, you can imagine a situation. You can imagine a situation extension is able to disable another extension in browser, like how bad it will be.

[00:24:42] - [Speaker 1]
So again, now we are on a internal page that belongs to AdBlockPlus, and if we try to run our extension on this page, then again we have a CSP violation issues. So yeah, that was safe. The next thing was some CSP privilege issues because the host permission will not work if there is any CSP error. So next I try to figure out if we can use the Execute Descript API to figure out how they deal with the CSP. So let's let's assume we have a page where the CSP is implemented properly, and we have a host permission for the same.

[00:25:25] - [Speaker 1]
So you can you can see the code where we are saying the content security policy, which is set to default SRC self. And we are using browser dot tabs or execute a script, which says code, and then where we have to pass the JavaScript code, which is a simple alert document or domain. So the way extensions deal with the CSP is that most of the browsers, they will allow JavaScript JavaScript from any extensions, until unless they will try to change the DOM particular DOM tree of particular documents. So let's suppose we have the first example right here. In this case, so as I said, let's assume we are on a page which has a perfectly CSP in place like this, and we try to change the DOM for the particular page.

[00:26:23] - [Speaker 1]
So the possible base we have is either we can use document dot write, or we can use document dot body dot inner HTML, and then certain JavaScript code. And then another possible way we have is to generate a random element and then write inside it. So all these ways to manipulate a particular DOM tree on a on a CSP protected page was not allowed by most of the browsers like Firefox and Chrome, but it was not protected in case of Edge. Like, the Execute Descript API is straightforward as execute any of the JavaScript code on any domain, whether you to change the DOM on a CSP productive page or not. Like it doesn't matter for it.

[00:27:14] - [Speaker 1]
So to conclude with this presentation is that extensions are still in development. Most of the APIs are not supported till the time because... And the edge that it has moved to the new Chromium based browser as well, so I'm not sure whether they are still developing extensions API or not. But the active tab is one of the interested permission to work on, because it allows you to execute JavaScript code on the current domain. So if you are able to perform the same sort of the same attack with active tab API as well, so pretty much you can have all what I presented here as well.

[00:27:57] - [Speaker 1]
So Microsoft, they have this... They finally decided to fix this bug in March nineteen update with the highest possible bounty they have with the CV twenty nineteen 0678. Yeah. That's it.

[00:28:18] - [Speaker 0]
So thank you Nikhil for an interesting talk. If you have questions about the talk, we have three microphones. One, two, and three in each one of the aisles. If you have a question, please come up to the microphone. We'll start from microphone number three.

[00:28:30] - [Speaker 2]
Hi. Hi. And thank you for the interesting talk. I have one question. Is this back or is this API also relevant for the new for the new Edge coming in January based on Chromium engine?

[00:28:48] - [Speaker 1]
No, I guess. So the APIs are same, but since the new route... The new Edge is running on Chrome, so they will not support this API based because of they use some others calling conventions, I guess, I believe. Okay. Does that answer your question?

[00:29:09] - [Speaker 2]
Yeah. But I have a second one.

[00:29:11] - [Speaker 0]
Yeah. Go for it.

[00:29:13] - [Speaker 2]
Okay. The second one is you tried to open the pages via the RES protocol but the functionality of those pages is it also handled by Edge while opening it through the RES protocol, not about the about protocol?

[00:29:33] - [Speaker 1]
Yes, I guess.

[00:29:35] - [Speaker 2]
Okay. We are also working. Yeah. Okay. Thank you.

[00:29:40] - [Speaker 0]
Any more questions from the crowd or from the Internet? Okay. Then another round of applause for Nikhil for a great talk. Thank you.

microsoft,google,