Giter VIP home page Giter VIP logo

orochi4268 / cve-2022-0337-poc-google-chrome-microsoft-edge-opera Goto Github PK

View Code? Open in Web Editor NEW

This project forked from puliczek/cve-2022-0337-poc-google-chrome-microsoft-edge-opera

0.0 1.0 0.0 14 KB

๐ŸŽฉ ๐ŸคŸ๐Ÿป [P1-$10,000] Google Chrome, Microsoft Edge and Opera - vulnerability reported by Maciej Pulikowski - System environment variables leak - CVE-2022-0337

HTML 100.00%

cve-2022-0337-poc-google-chrome-microsoft-edge-opera's Introduction

๐Ÿค Show your support - give a โญ๏ธ if you liked the content | SHARE on Twitter | Follow me on

CVE-2022-0337 System environment variables leak on Google Chrome, Microsoft Edge and Opera

๐Ÿ“ Description

Successful exploitation of this vulnerability can lead to the leak of user's secrets stored inside a system environment variables. A security bug was found in Chromium 92 version and patched in 97 version. There are several web browsers based on the chromium engine, for instance, Google Chrome, Microsoft Edge, Opera, and Brave. All of them were vulnerable, except for Brave. The vulnerability is in the File system access API, more specifically in window.showSaveFilePicker() method.


CVE Version: CVE-2022-0337

Credits: Maciej Pulikowski

Reward: $10,000 from Google VRP


Web browser versions vulnerability:

Chrome Edge Opera Firefox Brave
92-96 Vulnerable โ—๏ธโ—๏ธ
97+ Patched (safe) โœ”
92-96 Vulnerable โ—๏ธโ—๏ธ
97+ Patched (safe) โœ”
78-82 Vulnerable โ—๏ธโ—๏ธ
82 Patched (safe) โœ”
Safe โœ” Safe โœ”

Check your web-browser version:

  • Google Chrome: chrome://version/
  • Microsoft Edge: edge://version/
  • Opera: opera://update

Operation Systems:

ONLY WINDOWS are vulnerable. Linux and Mac are safe.

๐Ÿ“บ Youtube Proof of Concept

https://www.youtube.com/watch?v=q7OIEWtalg8

PoC Video

Thanks for the thumbs up and subscriptions ๐Ÿ˜€๐Ÿ‘

๐Ÿ‘จโ€๐Ÿ’ป Code Proof of concept

The simplest one

proof of concept gif

  1. Write in your Devtools:
let a = await window.showSaveFilePicker({suggestedName:'%username%'});
a.name;
  1. Save file
  2. Your username should appear

In the example, it is used a %username% environment variable. It returns Windows username logged in. Moreover, there are much more interesting environment variables:

Here are some examples:

  • AWS_SECRET_ACCESS_KEY
  • AZURE_CLIENT_SECRET
  • binance_secret
  • GITHUB_TOKEN
  • GOOGLE_API_KEY

and many more...

So the attacker could gain an access to targets AWS services, Github account or Binance token to API (withdraw money) and more...

Check out more secrets in environment variables on my repository:

๐Ÿฆ„๐Ÿ”’ Awesome list of secrets in environment variables ๐Ÿ–ฅ๏ธ

๐Ÿฆ„๐Ÿ”’ Awesome list of secrets in environment variables ๐Ÿ–ฅ๏ธ


Crafted HTML with improvlments

The previous example is run in local Google Chrome Devtools.

Obviously, the attacker could craft a special HTML file (website) to do successful exploitation of this vulnerability.

env.html - is an example of crafted special HTML in the repository.

But, do really user is required to download a file?

Yes, however, the attacker can create a website to encourage User to hold ENTER button on keyboard for 2 seconds to run and accept saving file dialog. Because windows dialog by default focus Save button, file will be saved with only blink.

env example on website (1) *.gif is from Opera (Chrome and Edge were already fixed)

In conclusion, user after holding the ENTER button on keyboard for 2 seconds could lead to leak of his system environments variables. This is a significant problem because user could store important secrets in system environments variable ex. Access to his AWS services, Github account or Binance

๐Ÿง  Things to remember from the write-up:

  • Environments variables can store secrets ex. tokens, api-key, secrets
  • if payload "%USERNAME%" or "$:USERNAME" or "${USERNAME}" or "$USER" return real username then target is vulnerable

๐Ÿ”จ Fix in chromium

I gave myself challange to repair the bug. Here, I would like to underline that I am not a c++ dev ๐Ÿ˜Ž.

source: https://bugs.chromium.org/p/chromium/issues/detail?id=1247389#c9

One of solution was to just replace character % in suggestedName to _ . It should solve the problem.

My solution:

image

could be insert in:

https://source.chromium.org/chromium/chromium/src/+/main:content/browser/file_system_access/file_system_chooser.cc;l=238?q=ResolveSuggestedNameExtension&ss=chromium%2Fchromium%2Fsrc

and the results are:

Before fix:

image

After my fix:

image

Indeed it solved the problem, but it wasn't the best place to insert the code ๐Ÿ˜‹ . However, I was very happy to manage to repair it by myself ๐Ÿ˜Ž

Final fix can be found here:

https://bugs.chromium.org/p/chromium/issues/detail?id=1247389#c12

๐ŸŒŒ Timeline

  • [07.09.2021, 10:40 PM GMT+2] Bug reported by Maciej Pulikowski
  • [07.09.2021, 11:36 PM GMT+2] Bug accepted (Pri:1, Severity-High)
  • [08.11.2021, 1:30 AM GMT+1] My submit for possible fix in code for chromium source
  • [10.12.2021, 6:09 PM GMT+1] Fixed
  • [7.01.2022, 2:09 AM GMT+1] Reward of $10,000
  • [18.03.2022, 6:30 PM GMT+1] Google removed security view restrictions

๐Ÿ’ป Useful links

๐Ÿค Show your support

๐Ÿค Show your support - give a โญ๏ธ if you liked the content | SHARE on Twitter | Follow me on

โœ”๏ธ Disclaimer

This project can only be used for educational purposes. Using this software against target systems without prior permission is illegal, and any damages from misuse of this software will not be the responsibility of the author.

cve-2022-0337-poc-google-chrome-microsoft-edge-opera's People

Contributors

puliczek avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.