How to recover stored wifi password?


Question

My Android device (A Samsung Galaxy S7 SM-G930F, version 6.0.1) has different wi-fi networks saved. I would like to recover some of the password it has stored.
Browsing through the web I searched possible solutions but none of it has worked for me.




  • Stored password in wpa_supplicant.conf are encrypted, and even if I change the build properties "ro.securestorage.support" to false, old password remain encrypted or get deleted, and I would like to recover those.

  • I know that wi-fi password usually get backed-up on google drive, but I have no idea how to recover them from the backup online.

  • I heard about an Xposed module "Wifi password" which supposedly should show the wifi password instead of the normal dots, but I have a TouchWiz device and if I install the Xposed Framework i'm afraid it would wipe my data, included my wifi password.



I understand that encryption is meant to keep safe your password, but as far as I know, every time I try to connect to a wifi network it uses the real password, so they have to be stored somewhere or decrypted on the go.



Can anyone help me?



EDIT: As I said, if I change ro.securestorage.support property on build.prop file, my stored password either get deleted or they remain hashed.



If i delete .system.wpa_supplicant




all saved WiFi hotspots will be lost for the first time.




Also as said in the comments, the password isn't encrypted so there's no "way" to decrypt it, but it's hashed and there should be a way to recover it


Answer

The hex value you found in the wpa_supplicant.conf is the PMK (not the PSK directly but some intermediate value computing the PSK or something like this). This value is not encrypted, it is hashed as defined by WPA2 using PBKDF2 SHA-1 with 4096 iterations see Wikipedia.



SHA-1 is a one-way function, which means that it can not be reversed.



Wifi still works, because the PSK is the actual key Wifi requires to work. The passphrase is just for the "dumb humans who can't remember a simple 64 hex chars value" (aka user convenience).



Hence there is no "decrypt" function. The only way to retrieve the password back is to perform a brute force search on that password (trying all possible passwords). Depending on the length of the password and your hardware (CPU, GPU) this can take some days, weeks, months or years.



There is an issue on Github with indicates that the tool "hashcat" is able to break this value using mode 12000 (-m 12000):



See also Encryption algorithm used in WPA/WPA2


Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes