Apple Mac firmware. Layout, Data Space and Variables.


Rendering Error in layout Widget/Social: Call to a member function exists() on null. Please enable debug mode for more information.
More
9 years 1 month ago - 9 years 1 month ago #262 by token.paul
Apple Mac's firmware almost corresponds to the Intel specification for Flash Images. Almost, because that Bios Region is used as data storage for OS specific values, EFI-password, EFI and/or ME applications (some executables if to be fair) and other Apple specific data.
Apple ROMs contain 3 regions: Flash Descriptor, ME Region, BIOS Region. Sizes and offsets defined in Flash Descriptor and can be detected by utilities such as 'flashrom' during a flash chip reading or FITS. FITS however can not read the data within the BIOS and ME regions, but can build a map-file with sizes and offsets for all regions.

BIOS Region inside ROM file can be divided on 2 parts. The first portion is a BIOS itself, the second - Apple specific data.

Line of separation can be found at a 32-bytes sequence:

00000000000000000000000000000000
8D2BF1FF96768B4CA9852747075B4F50


Offset is depended from model or chipset used in model. Can little migrate, but always follows after BIOS code.

Apple specific block contain as minimum 3 independent parts.
  1. Machine configuration, bootloader configuration, OS relative configuration such as audio volume, Wi-Fi networks, Bluetooth devices configuration (keyboard and mouse) etc. Also block with machine serial number and model number definition.
  2. EFI-password block
  3. Block with EFI/ME applications. This area does not discovered fully, so any suggestions are welcome.

The Variables inside Apple specific data block.



Every variable's record within ROM-file corresponds to EFI Variable Services Feature. Variable namespaces are identified by GUIDs, and variables are key/value pairs. At the storage (inside ROM-lise) variables are can be identified by formula:

[Descriptor 0x10 bytes][GUID 0x10 bytes][key/value pair, size defined by descriptor]

Where,
Descriptor: The first 2 bytes = 'AA55'. Next 2 bytes = 7F00 or 7C00 or 7D00 and likely be interpreted as state of a variable's record. According to my observations only '7F00'-state vars appear in EFI environment. (EFI shell 'dmpstore' command used for analyze)
Next 4 bytes seems used as 'variable record format' key. In ROMs which I parse it is a sequence '07000000' or '07000080'.
Next 4 bytes is a length of a key. And next 4 bytes is a value's length. Both are little endian 32-bit digits.

GUID: 16 bytes. Should be read by formula:
[4 bytes as little endian 32-bit unsigned][2 bytes as little endian 16-bit unsigned][2 bytes as little endian 16-bit unsigned][6 bytes as sequence]

Key/Value pair:
Sizes for key and value defined in the Descriptor. Storing format is depended on data in a second 4 bytes of Descriptor.
If it '07000000' then key/value data follows immediately after GUID. If it '07000080' you need skip 4 bytes after GUID and read data as defined in the Descriptor.
Attachments:
Last edit: 9 years 1 month ago by token.paul.
The following user(s) said Thank You: ferdeenand

Please Log in or Create an account to join the conversation.

More
9 years 1 month ago #266 by thaGH05T
Very useful info, what conclusion can you come to with the dumps that you have?

Please Log in or Create an account to join the conversation.

More
9 years 1 month ago - 9 years 1 month ago #267 by token.paul
Answer on question: What inside? It is a main conclusion, I think.
I'll write another article about password area, how password stored and how to determine is set or not. This info should be enough to implement an application for cleaning dumps taken from a chip.
Last edit: 9 years 1 month ago by token.paul.

Please Log in or Create an account to join the conversation.

More
9 years 1 month ago #269 by thaGH05T
There is only one problem I think. As I have said before this cannot work on a lot of dumps. I can/will provide you with these so you can test them as well to determine their offsets to be modified for the password area.

Please Log in or Create an account to join the conversation.

More
9 years 1 month ago #270 by token.paul
SSH,perl and lot of dumps will enough. Or I should to receive archive... Anyway, I believe that 'universal-way' exist.

Please Log in or Create an account to join the conversation.

More
9 years 1 month ago #279 by token.paul
Yep... need check my approach. I wrote script which makes search for password area, password records and create offsets map.
As fact, data in ROM file can slide and when we found offset for one EMC different offset on other EMC will necessarily be. So, I have to use 'relative orientation' theory in script... It almost done. 2/3 of plan.

Please Log in or Create an account to join the conversation.

More
9 years 1 month ago - 9 years 1 month ago #280 by token.paul
Initial version of 'rom_scanner' script.
Script do scan of a file as command line argument. Performs checking of Intel Flash Image signature for Series 6,7,8 chipsets, makes a search for 'Apple Specific' area and password area, calculates offsets, makes checking of matching data from file to known stamps. For each found 'password' record parsing will performed.


File Attachment:

File Name: rom_scanne...tial.zip
File Size:3 KB


An example:
./rom_scanner.pl ./EMC2745.bin 
System byteorder: Little Endian
ROM: ./EMC2745.bin
Intel Flash Image signature found
Apple Specific Data block start at:     0x00610000          
Scanner should find first var within 160 bytes of data... 
'PchInit' usually... or 'Setup'
	Variable at:  0x00610060 RFT: 2 Sizes (Key: 16 Value: 4)
	GUID: 0af7c2e604b6774885badeec89e117eb  at:0x00610070 (6357104)
	Key: PchInit 	Value: 0040fd7a 
                                                            
File size: 0x007fffff (8388608) bytes. Record fromat type 2 detected

= Calculated SVS start offset: 0x00632050 (6496336)=
SVS: 24535653b01f00005afefe0100000000
==		Match stamp type: 2
= Calculated SVS end offset: 0x00634050 (6504528)=
SVS: 24535653b01f00005afefe0100000000
==		Match stamp type: 2
Password area looks fine...  Password area seems clean.
Password record parsing... 
GUID: 5ea78df6551b704eb41ba7b7a5b758ea offset: 0x00632070 (6496368)
	State: 7f00, Key: 3E6D568B, Value Size: 4
	Value: 02000500
GUID: 5ea78df6551b704eb41ba7b7a5b758ea offset: 0x006320aa (6496426)
	State: 7f00, Key: BC9772C5, Value Size: 8
	Value: 92e6f4d189eb76ac

==
Record style type: 2
Password area: 0x00632050 - 0x0063405f, password GUIDs within area: 2
Attachments:
Last edit: 9 years 1 month ago by token.paul.

Please Log in or Create an account to join the conversation.

More
9 years 1 month ago #282 by thaGH05T
I like what you have done, I will run the script against a few dumps to see what the result is.

Please Log in or Create an account to join the conversation.

More
9 years 1 month ago - 9 years 1 month ago #284 by token.paul
I run it with EMC2555,EMC2428,EMC2554,EMC2745,EMC2881.
Still there a Rom file of EMC2395 model is not a Series 6+ model, and rom of my MBP 2008 year of production... Script found the first variable, that is surprising.
Last edit: 9 years 1 month ago by token.paul.

Please Log in or Create an account to join the conversation.

More
9 years 1 month ago #286 by thaGH05T
I will test very soon. I am working on the clips to interface with the MBA boards so ppl wont have to solder directly to them...

Please Log in or Create an account to join the conversation.

More
9 years 1 month ago #299 by token.paul
Is it some kind of wire with a SOIC clip? I bought today rapsberry pi. As I can see it is a must have device.

Please Log in or Create an account to join the conversation.

More
9 years 1 month ago #302 by thaGH05T
If you are asking what kind of wires then just female to female connectors with a 8 pin SOIC clip will work. Token I think we can come up with a better way than the Pie... I will talk with you about this. You are a programmer correct?

Please Log in or Create an account to join the conversation.

More
9 years 1 month ago #303 by token.paul
I bought PI to find better way. It will pity if because a stupid mistake machine will turn into brick and I can not fix it. I just must be ready for in-circuit operations.
Also I bought it for fun... let it turn on/off a tea makers...

You are a programmer correct?

I never thought about it. My main job is the networks and I love UNIX. I can write some code... but I call it as 'shit-script' because code itself little lame as I think.
I was spent much time with C language study, unsuccessful. I can read and little change foreign code but I can't write own from scratch. And for my job this skill does not needed. Perl, Shell and PHP was always enough. Actually code-writting is less interesting for me than analysis and logic inventing. I like search solutions.

Please Log in or Create an account to join the conversation.

More
9 years 1 month ago - 9 years 1 month ago #305 by token.paul
Interesting info: http://code.coreboot.org/svn/flashrom/trunk/Documentation/mysteries_intel.txt

Citation:

Intel's flash image tool will always expand the last region so that it covers the whole flash chip, but some boards ship with a different configuration. It seems that in descriptor mode all addresses outside the used regions can not be accessed whatsoever. This is not specified anywhere publicly as far as we could tell. flashrom does not handle this explicitly yet. It will just fail when trying to touch an address outside of any region.

It may means that 'Apple Specific' area is not a part of the BIOS region and can be locked by ME. While we don't know how ME handle its blocks on the flash it should be as warning. All of this should be checked of course.

P.S. This info applicable for 'flashrom -p internal...' process only.
Last edit: 9 years 1 month ago by token.paul.

Please Log in or Create an account to join the conversation.

More
9 years 1 month ago #311 by thaGH05T
Interesting, I have never seen this as it always gives me a mismatch if it is not exactly the size of the chip.

Please Log in or Create an account to join the conversation.

More
9 years 1 month ago #323 by token.paul
The problem as I can see is that space on the flash after BIOS is a 'BIOS Region' formally only. Stupid situation... Intel permits to divide a flash between different software such as 'Apple Specific' data, ME storage... etc BUT it does not have a manner to control it. It is very good, because we can read and may be write almost any part of flash. When I tried to parse Descriptor Region I only found offsets for beginning each region but not end. I found offsets for SPI lockdowns, but they are formally again, just addresses list, no more. The question is: What internal programmer can do? Can it write to locked down areas if 'force' was said?
However... problem. If password area is locked by ME as opened file or mounted filesystem for example, we cannot do correctly patch for area. Who ME handle it?
ah... I am in problem too... I can't explain... not have enough knowledge of English. Sorry...
My idea for now is attempt to patch the password area with clean records taken from clean dumps. I have both types of password area and can detect records type (my script does it) When I receive Raps PI, I will try patch ROM on my iMac with 'flashrom' and internal board programmer i.e. 'flashrom -p internal' and will use layout option where offset of password area will be defined, so 'flashrom' will erase and write the password area only and nothing else. It is experiment. And 3 expected results:
1. 'flashrom' just die on write attempt and do nothing
2. 'flashrom' writes area but after restart area will corrupted
3. 'flashrom' writes area successful and we will have 'Software' for password clean up.

Please Log in or Create an account to join the conversation.

More
9 years 1 month ago #328 by thaGH05T
Let me start the drumroll :)

Please Log in or Create an account to join the conversation.

More
6 years 8 months ago - 6 years 8 months ago #7586 by maq2130
ok don't know if this is what you where looking for but i removed a mx25l6406e from a macbook air and read and dumped flash with my Jtag-nt which is blazing fast it took less than a minute and i modded it to remove efi lock and when i was about to load it back i noticed it was 16mb so i changed the settings of the jtag-nt to read 8mb flash and dumped again and verified removed the efi lock again and load it back. ok after that i compared both dumps and i saw the bytes from the extra 8mb of the 16mb dump were not empty it had extra data.
Last edit: 6 years 8 months ago by maq2130.

Please Log in or Create an account to join the conversation.

Who's Online

We have 898 guests and no members online

N00BZ

  • ljamal
  • ljamal74
  • mikeg2atest
  • ducchinhbui
  • anjarezt

Cookies