A forum for reverse engineering, OS internals and malware analysis 

Forum for announcements and questions about tools and software.
 #13293  by p4r4n0id
 Fri May 18, 2012 7:05 am
Hi Guys,

Does anyone familiar with a tool / code snip. / tech / info..... that gives the ability to configure the BIOS from command line / via code ?

Is it possible? maybe @boot time?

Much appreciated,

p4r4n0id
 #13298  by Vrtule
 Fri May 18, 2012 11:14 am
Hello,

I know that HP was giving HP Protect Tools application to its notebooks some years ago. It looked like the application was able to configure some BIOS settings. However, it seemed to be GUI version only. And I don't know the present.
 #13302  by frank_boldewin
 Fri May 18, 2012 5:42 pm
you can easily code a bios editor/reader by yourself.

for more details check this out: http://www.bioscentral.com/misc/cmosmap.htm

keep in mind that higher offsets in the CMOS are proprietary to the different BIOS manufactures.

example code for accessing the CMOS can be found here: http://wiki.osdev.org/CMOS
of course you need a driver to access the IO ports 70h/71h.

hope that helps.
 #13305  by p4r4n0id
 Fri May 18, 2012 9:03 pm
Hi Frank,

Thx a lot for the very useful links, will help me a lot !

got another question , do u think it will be possible to enable / disable virtualization hardware extensions this way?

Thx again,

frank_boldewin wrote:you can easily code a bios editor/reader by yourself.

for more details check this out: http://www.bioscentral.com/misc/cmosmap.htm

keep in mind that higher offsets in the CMOS are proprietary to the different BIOS manufactures.

example code for accessing the CMOS can be found here: http://wiki.osdev.org/CMOS
of course you need a driver to access the IO ports 70h/71h.

hope that helps.
 #13311  by frank_boldewin
 Sat May 19, 2012 7:49 am
you can give it a try. if you don't know the exact offset or bit to flip, i would do a complete snapshot of the CMOS first and save it in a file to disk.
then reboot and enter the bios setup on your machine and enable the virtualization hardware extension and do a snapshot again. when comparing the to snapshots, next to the usual time counter, there should be something changed now. if you had success, try it on other boxes and check if this a constant offset in all BIOSes or changing from version to version resp. from manufacturer to manufacturer.
 #13340  by feryno
 Mon May 21, 2012 9:14 am
disabling the virtualization is question of few asm instructions, refer to these MSRs in CPU manuals:

AMD:
MSRs C0010114h VM_CR (bits 3., 4.), C001_0118h SVM_KEY

Intel:
MSR 3Ah IA32_FEATURE_CONTROL (bits 0., 2.)

enabling disabled virtualization:

AMD:
if bit 4. of VM_CR is 1 then virtualization is disabled (because EFER.SVME cannot be written to 1), to erase bit 4. of VM_CR to 0 and enable virtualization, you need to test the bit 3. whether you can or can't do that
then if bit 3. of VM_CR was set to 1 (by BIOS or by your program), you need to know the SVM_KEY (or a lot of time to break the key which is 64 bit) and is even impossible if the key is 0

Intel: after writing 1 into bit 0. of IA32_FEATURE_CONTROL this MSR cannot be reprogrammed back (only power-up / reset way) so writing 0 into bit 2. at the same write disables the virtualization (VMXON causes #GP) until reset, if both bits 0. and 2. are zero, you can enable virtualization by writing 1 into bits 0., 2.
 #13350  by EP_X0FF
 Tue May 22, 2012 3:07 am
Offtop removed.

http://www.rom.by/

Take a look, here big amount of BIOS editors for Award/AMI/Phoenix, see downloads section.
 #13352  by p4r4n0id
 Tue May 22, 2012 3:22 am
@All:

Thx a lot guys!!! very helpful info!

Actually it is a very simple task, once you showed me the way..... :)

~15 lines of code and it is done. :)

thx again to all!

p4r4n0id