Removing WLAN/WWAN BIOS whitelist on a Lenovo laptop to use a custom Wi-Fi card-程序员宅基地

技术标签: 转载专用  Idapro  Modding  Whitelist  Uefi  Reverse Engineering  

So I had a Lenovo G510 that had a pretty bad Wi-Fi card. Once upon a time I’ve decided that it needs to be replaced, the most importantly to cover 5 GHz band, since the amount of other 2.4 GHz networks was large enough to make me loose the signal in the other room frequently enough. Before buying the card, however, I went on a little search only to find out (besides others also complaining about poor pre-installed Wi-Fi card) that Lenovo had put a whitelist check in BIOS and would only let you run “authorized” cards. What a pity. Following that I did read that BIOS is write-protected and the only way to modify it (in order to remove said whitelist) was to use an SPI programmer. That sounded interesting, so I thought I’ll give it a try and bought one.

I struggled a bit to find any good resources on this topic and it is the reason I’m writing this article. Besides removing whitelist, I also wanted to delete BIOS password that I apparently had set up a long time ago and forgot. Eventually I gave up on the latter, but removing the whitelist proved to be very easy following you know how to access the needed PE image section.

Firstly, some tips related to the SPI programmer stage. Before you do anything, you need to obtain the BIOS dump. It needs to be yours and you need to later flash it on the same laptop. You cannot download a clean image from vendor or a dump from someone else. Or maybe you can, but it could cause some side effects. I personally used CH341A-based device, along with the software that came with it (and SOIC8 clip, so I didn’t have to desolder the chip). Since my exact chip model (25Q064A) wasn’t listed, I was trying both EON EN25Q64 and Winbond W25QBV, both did work for it. Now for the reading part — you should clip the chip and read it with verify, then save the result, at least 2 times. Then compare files’ checksums. That way you will make sure the dump and clipping is correct. Before saving a file, make sure the read contents are not all “FF FF FF …” ‘till the end, because that means it’s empty and the clipping is wrong — re-adjust it and try again.

If you disconnect your clip before flashing, then you want to make sure it reads correctly before that as well (tip: chip contents and checksum will change after a boot, so don’t worry then if checksums differ from your previous dumps, you can flash then still flash their modified version over with no problems). For flashing the mod after it’s complete, load the file and press Auto button. It is going to erase the chip, verify it’s empty, flash new contents and verify they’re saved correctly. Do not flash chip before first erasing its contents, it will not work properly.

For the mod part, get UEFITool. You may want to get both old engine and new engine versions. The former lets you actually replace the body of different parts of your image, so this is required for us, the latter displays names instead of GUIDs in the tree, and it has search function, which you will need.

Open your dump in UEFITool NE and search for our beloved string of “Unauthorized Wireless network card is plugged in” (tick Unicode option).

 

Then open the same file in older branch UEFITool and try finding the same PE32 image section in the tree (you can click in names on NE items to find out what their GUIDs are).

Then right-click it and extract the body. This is what we’ll need to modify. I personally used IDA Pro, but if you follow this tutorial, you might just as well use a hex editor.

The easiest way to find our function in IDA was to search for sequence of bytes (our string):

55 00 6E 00 61 00 75 00 74 00 68 00 6F 00 72 00 69 00 7A 00 65 00 64 00 20 00 57 00 69 00 72 00 65 00 6C 00 65 00 73 00 73 00 20 00 6E 00 65 00 74 00 77 00 6F 00 72 00 6B 00 20 00 63 00 61 00 72 00 64 00 20 00 69 00 73 00 20 00 70 00 6C 00 75 00 67 00 67 00 65 00 64 00 20 00 69 00 6E

Then double-click on the only result to go to IDA View to find out that it was correctly identified as UTF-16LE string. Click on its autogenerated name and press X to go to Xrefs, and open the only function that pops up. Press hotkey for your decompiler if you have it installed.

We see the checks and an infinite while loop under that. This is what physically prevents our PC from booting up once it detects “unauthorized” card. We need to modify it. Go to IDA View and locate the infinite loop. It’s easy to see due to an arrow pointing back to the same location block.

Now press a jz a bit above it that either enters the loop or skips it based on the result of a test instruction above, and press Edit → Patch program → Assemble…

Change the instruction from jz to jmp, that way it will always make the jump to the location after the infinite loop.

You can also go to Hex View and change the highlighted 74 to EB manually.

But we can also see that these functions check the whitelist at all only if these variables are true:

Let’s locate what they are via Xrefs. We went back into _ModuleEntryPoint and we see that they are copied from yet another globals.

Let’s see what they are.

Bingo! Seems like this is global configuration for this module that configures whether WLAN and WWAN whitelists are enabled. It will be as simple as changing these two global bytes from 1 to 0 to mitigate our whitelist completely! Click on the respectable bytes and you will see what they are in Hex View.

To edit these, just right click, click “Edit…”, do edits, then “Apply changes” (or F2). Easy enough, right? If you don’t have IDA Pro, you should be able to reproduce these changes in any generic hex editor. Now to save modified file in IDA, go to Edit → Patch program → Apply patches to input file…

Once that’s done you can replace the image’s body in UEFITool (old engine).

After that press File → Save image file… It will ask you whether you want to load the modified file. Select Yes, and verify there are no errors, then export the modified body again and verify that its checksum matches with the file you created. If it does, you’re ready to flash your new BIOS!

This all worked for me. Definitely let me know if this article did help you in any way as well.

Links:
· https://www.youtube.com/watch?v=2Y06x1f22B0 — very good tutorial on using SPI programmer
· https://github.com/LongSoft/UEFITool — UEFITool
· https://github.com/gdbinit/EFISwissKnife — didn’t use this, but looks like it might be super-useful if I was to do more in-depth modding
· https://github.com/bdutro/ibm_pw_clear — interesting method one person used to clean a password on a server IBM
· https://web.archive.org/web/20120126182637/http://sodoityourself.com/hacking-ibm-thinkpad-bios-password/ — interesting for password retrieval, but old
· https://highside.pl/G510.jpg — location of the BIOS chip on G510’s motherboard (yeah, we need to disassemble pretty much whole laptop to parts in order to access it)
· https://www.bios-mods.com/forum/Thread-General-method-to-remove-whitelist-from-Insyde-BIOS — kind of similar approach, although it used almost 10 year old program to mod BIOS and did modify its memory, where it stored unpacked BIOS, and it only did patch out the infinite loop; I stumbled upon this initially, didn’t work for me, maybe this EzH2O software is just too old now 

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/qq1332479771/article/details/103542241

智能推荐

python简易爬虫v1.0-程序员宅基地

文章浏览阅读1.8k次,点赞4次,收藏6次。python简易爬虫v1.0作者:William Ma (the_CoderWM)进阶python的首秀,大部分童鞋肯定是做个简单的爬虫吧,众所周知,爬虫需要各种各样的第三方库,例如scrapy, bs4, requests, urllib3等等。此处,我们先从最简单的爬虫开始。首先,我们需要安装两个第三方库:requests和bs4。在cmd中输入以下代码:pip install requestspip install bs4等安装成功后,就可以进入pycharm来写爬虫了。爬

安装flask后vim出现:error detected while processing /home/zww/.vim/ftplugin/python/pyflakes.vim:line 28_freetorn.vim-程序员宅基地

文章浏览阅读2.6k次。解决方法:解决方法可以去github重新下载一个pyflakes.vim。执行如下命令git clone --recursive git://github.com/kevinw/pyflakes-vim.git然后进入git克降目录,./pyflakes-vim/ftplugin,通过如下命令将python目录下的所有文件复制到~/.vim/ftplugin目录下即可。cp -R ...._freetorn.vim

HIT CSAPP大作业:程序人生—Hello‘s P2P-程序员宅基地

文章浏览阅读210次,点赞7次,收藏3次。本文简述了hello.c源程序的预处理、编译、汇编、链接和运行的主要过程,以及hello程序的进程管理、存储管理与I/O管理,通过hello.c这一程序周期的描述,对程序的编译、加载、运行有了初步的了解。_hit csapp

18个顶级人工智能平台-程序员宅基地

文章浏览阅读1w次,点赞2次,收藏27次。来源:机器人小妹  很多时候企业拥有重复,乏味且困难的工作流程,这些流程往往会减慢生产速度并增加运营成本。为了降低生产成本,企业别无选择,只能自动化某些功能以降低生产成本。  通过数字化..._人工智能平台

electron热加载_electron-reloader-程序员宅基地

文章浏览阅读2.2k次。热加载能够在每次保存修改的代码后自动刷新 electron 应用界面,而不必每次去手动操作重新运行,这极大的提升了开发效率。安装 electron 热加载插件热加载虽然很方便,但是不是每个 electron 项目必须的,所以想要舒服的开发 electron 就只能给 electron 项目单独的安装热加载插件[electron-reloader]:// 在项目的根目录下安装 electron-reloader,国内建议使用 cnpm 代替 npmnpm install electron-relo._electron-reloader

android 11.0 去掉recovery模式UI页面的选项_android recovery 删除 部分菜单-程序员宅基地

文章浏览阅读942次。在11.0 进行定制化开发,会根据需要去掉recovery模式的一些选项 就是在device.cpp去掉一些选项就可以了。_android recovery 删除 部分菜单

随便推点

echart省会流向图(物流运输、地图)_java+echart地图+物流跟踪-程序员宅基地

文章浏览阅读2.2k次,点赞2次,收藏6次。继续上次的echart博客,由于省会流向图是从echart画廊中直接取来的。所以直接上代码<!DOCTYPE html><html><head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" /&_java+echart地图+物流跟踪

Ceph源码解析:读写流程_ceph 发送数据到其他副本的源码-程序员宅基地

文章浏览阅读1.4k次。一、OSD模块简介1.1 消息封装:在OSD上发送和接收信息。cluster_messenger -与其它OSDs和monitors沟通client_messenger -与客户端沟通1.2 消息调度:Dispatcher类,主要负责消息分类1.3 工作队列:1.3.1 OpWQ: 处理ops(从客户端)和sub ops(从其他的OSD)。运行在op_tp线程池。1...._ceph 发送数据到其他副本的源码

进程调度(一)——FIFO算法_进程调度fifo算法代码-程序员宅基地

文章浏览阅读7.9k次,点赞3次,收藏22次。一 定义这是最早出现的置换算法。该算法总是淘汰最先进入内存的页面,即选择在内存中驻留时间最久的页面予以淘汰。该算法实现简单,只需把一个进程已调入内存的页面,按先后次序链接成一个队列,并设置一个指针,称为替换指针,使它总是指向最老的页面。但该算法与进程实际运行的规律不相适应,因为在进程中,有些页面经常被访问,比如,含有全局变量、常用函数、例程等的页面,FIFO 算法并不能保证这些页面不被淘汰。这里,我_进程调度fifo算法代码

mysql rownum写法_mysql应用之类似oracle rownum写法-程序员宅基地

文章浏览阅读133次。rownum是oracle才有的写法,rownum在oracle中可以用于取第一条数据,或者批量写数据时限定批量写的数量等mysql取第一条数据写法SELECT * FROM t order by id LIMIT 1;oracle取第一条数据写法SELECT * FROM t where rownum =1 order by id;ok,上面是mysql和oracle取第一条数据的写法对比,不过..._mysql 替换@rownum的写法

eclipse安装教程_ecjelm-程序员宅基地

文章浏览阅读790次,点赞3次,收藏4次。官网下载下载链接:http://www.eclipse.org/downloads/点击Download下载完成后双击运行我选择第2个,看自己需要(我选择企业级应用,如果只是单纯学习java选第一个就行)进入下一步后选择jre和安装路径修改jvm/jre的时候也可以选择本地的(点后面的文件夹进去),但是我们没有11版本的,所以还是用他的吧选择接受安装中安装过程中如果有其他界面弹出就点accept就行..._ecjelm

Linux常用网络命令_ifconfig 删除vlan-程序员宅基地

文章浏览阅读245次。原文链接:https://linux.cn/article-7801-1.htmlifconfigping &lt;IP地址&gt;:发送ICMP echo消息到某个主机traceroute &lt;IP地址&gt;:用于跟踪IP包的路由路由:netstat -r: 打印路由表route add :添加静态路由路径routed:控制动态路由的BSD守护程序。运行RIP路由协议gat..._ifconfig 删除vlan

推荐文章

热门文章

相关标签