[R&D] Unlock Bootloaders

Status
Not open for further replies.
Search This thread

AdamOutler

Retired Senior Recognized Developer
Feb 18, 2011
5,224
9,827
Miami, Fl̨̞̲̟̦̀̈̃͛҃҅͟orida
Rules:
Do not post in here unless you have something constructive to say. "Thanks", "Hey this is wonderful", and any other comments like that are not wanted. They take up space and make it more difficult to find information. I'm requesting that this thread be heavily moderated. In order to work efficiently, information density must be kept high. We are all guilty of adding in a few off-topic sentances from time-to-time, but this thread is strictly business and I expect the moderators to moderate me as well.

What is this?
This is the place where we can research and develop a method to unlock the bootloader of the Verizon Galaxy SIII. Hopefully, this will be development at its finest.


Why not just buy a developer edition
GTFO! Not a single person got started developing by buying a developer phone. They started developing because they were unhappy with the features of their device and wanted something better. They wanted something more. This developer phone is a tax on developer innovation. We do not stand for that. We will break the security and we will enable XDA-Developers to do what they do best.

Until security is broken and available for everyone, this device will get updates last, users will be unhappy because there are no additional features and Samsung violates the spirit of Open Source and copyright laws. Take a look at the bottom line of GPL-Violations.org FAQ located here: http://gpl-violations.org/faq/sourcecode-faq.html


What are the goals?
  • Attain a bootloader recovery - 75% JTAG (the extra 25% will be for a user-friendly method)
    The Galaxy S3 is bootable from SDCard. In case of emergency this is needed. We need to verify that this works on the Verizon GS3 to bring up Odin. This will set up infrastructure for research.
  • Attain a full stock restoration via Odin or Heimdall - 90%
    For use with Odin3.
    Bootloader - BOOTLOADER_I535VRALF2_618049_REV09_user_low_ship.tar.md5 - 1.97 MB - Thanks nbsdx
    PDA - SCH-I535_VZW_1_20120705143513_fti2qg2lmf.zip
    NEED CSC PACKAGE (MODEM, PARAMS and Other Miscellaneous partitions). This is enough to recover a device though.
    To include bootloaders and recovery to a working and stock condition with the EMMC wiped entirely. Heimdall is a work in progress for this device. This will complete the infrastructure needed for research.
  • Collect information
    This will be the longest and most difficult part of this development. The information provided by Qualcomm is not readily available. Samsung is notoriously secretive about their bootloaders. Mainly we, as a community, will generate information. Please post any relevant datasheets, theory-of-operation, or manuals which you can find.
  • Provide a way to remove security checks from Odin3.] 100% - insecure aboot.img which may break in the future
    By removing security checks from Odin3 on the computer or the Loki daemon on the device we can flash anything through Odin or Heimdall.
  • Provide a way to bypass security checks within bootloaders. 200% we have two exploits, only one has been released.
    This is the ultimate goal. Once we can bypass the security checks, kernels can be flashed giving us the control required to develop


Initial information
[BOOTLOADER] Locked bootloader research and news: http://xdaforums.com/showthread.php?t=1756919


My own research

SBL1 is the first booting partition. Qualcomm provides the Modem partition so it comes first on the EMMC. SBL1 is the first bootloader and that is specified by Qualcomm standards. Qualcom mmake sthe primitive bootloader and allows their customers (Samsung) to make a Secondary bootloader. Samsung chose to use three secondary bootloaders.

The following 0p* are located in /dev/block/mmcblk*

0p1 = modem
Built by se.infra
HUDSON_GA_D2_USA-VZW-HARDKEY-PROD-USER
I take this to mean this Qualcomm modem was built in Hudson Georgia.
I was not able to find signatures on this block :). This does NOT mean that there are no signatures on this block. The file is 33 megs. The file is unencrypted.
The modem uses the BLAST Kernerl ver : 02.04.02.02.00 Unfortunately we need someone who speaks French(???) to understand how this works http://blast.darkphpbb.com/faq.php
Judging by the contents of this file, it is an operating system of it's own including keyboard, mouse and a lot of debugging information. We need to find out more about the BLAST Kernel and this partition.


Samsung Proprietary partitions SBL1,2,3
Overall I'm not entirely familiar with this new 3 SBL setup. If someone could help me out, that would be great. This 3 SBL setup looks like they tried to adapt (slopily) their IBL+PBL+SBL setup to the Qualcomm and added overhead.

op2=sbl1
This block is signed by Samsung, we will not be able to modify it.
Some Strings we expect to see on UART are:

0p3=sbl2
This block is signed by Samsung, we will not be able to modify it.

Some of the strings we may see over UART are:
Code:
RPM loading is successful.
cancel RPM loading!
SBL2, End
SBL2, Delta
.sbl2_hw.c
sbl2_hw_init, Start
sbl2_hw_init, Delta
sbl2_hw_init_secondary, Start
h/w version : %d
sbl2_hw_init_secondary, Delta
.SBL2, Start
scatterload_region & ram_init, Start
.scatterload_region & ram_init, Delta
.sbl2_mc.c
sbl2_retrieve_shared_info_from_sbl1, Start
.sbl2_retrieve_shared_info_from_sbl1, Delta

0p4=sbl3
This block is signed by Samsung, we will not be able to modify it.

Possibly useful information:
SVC: R1-R14
FIQ:R13-R14
IRQ:R13-R14
UND:R13-R14
ABT:R13-R14
SYS:R13-R14

This block appears to be a full OS of its own. I'm not sure of its purpose.

op5= aboot
This block is signed by Samsung, we will not be able to modify it

This block contains HTML information. It would appear that it is possible to put the device into a mode where it will provide a webserver which displays state information.

This block appears to be a complete operating system

This block contains the Loke Daemon which communicates with Odin3.


0p6= rpm
This block is signed by Samsung we will not be able to modify it

0p7= boot
This is the kernel. There are several things we can do here... I belive this package itself is not signed, but the zImage itself is... here is the bootimg.cfg file

Code:
adam@adam-Desktop:~/Desktop/VZWGS3$ cat ./bootimg.cfg 
bootsize = 0xa00000
pagesize = 0x800
kerneladdr = 0x80208000
ramdiskaddr = 0x81500000
secondaddr = 0x81100000
tagsaddr = 0x80200100
name = 
cmdline = console=null androidboot.hardware=qcom user_debug=31

It may be possible to use that cmdline variable as an exploit.




0p8= tzTrust Zone
0p9= pad
0p10= param -boot mode parameters - this could be a potential exploitation point.
0p11= efs -serial numbers
I've honestly got no clue about most of the following partitions.
0p12= modemst1
0p13= modemst2
0p14= system - Android stuff
0p15= userdata - App Stuff
0p16= persist
0p17= cache - Storage for updates
0p18= recovery - recovery partition
0p19= fota
0p20= backup
0p21= fsg
0p22= ssd
0p23= grow

External UART log from initial power up:
Code:
[1630] AST_POWERON
[    0.000000] heap->name mm, mb->start c0000000
[    0.000000] Reserving memory at address ea000000 size: 100000
[    0.000000] sec_dbg_setup: str=@0x88d90004
[    0.000000] sec_dbg_setup: secdbg_paddr = 0x88d90004
[    0.000000] sec_dbg_setup: secdbg_size = 0x40000
[    0.000000] etb_buf_setup: str=@0x8fffb9c0
[    0.000000] etb_buf_setup: secdbg_paddr = 0x8fffb9c0
[    0.000000] etb_buf_setup: secdbg_size = 0x4000
[    0.174515] rdev_init_debugfs: Error-Bad Function Input
[    0.174881] AXI: msm_bus_fabric_init_driver(): msm_bus_fabric_init_driver
[    0.176957] sec_debug_init: enable=0
[    0.177475] ec_debug_nit: restrt_reason: 0xdf0085c
[    .216358] msm8960_iit_cam:292]settingdone!!
[    0.25006] i2c 2c-14: Inalid 7-bi I2C addrss 0x00
    0.25237] i2c ic-14: Can' create evice at x00
[   0.252220]i2c i2c-1: Failed o registeri2c clien cmc624 t 0x38 (-6)
[    .252250] 2c i2c-19:Can't crete deviceat 0x38
    0.25433] rdevinit_debufs: Error-ad Functin Input
    0.25222] max892 19-006: DVS mode disabledbecause VD0 and VI1 do not ave prope control.
[    0.79536] ms_etm msm_tm: ETM tacing is ot enable beacaussec_debug s not enaled!
[   0.284449 smd_chanel_probe_orker: alocation tble not iitialized
                                                                  [    0.38766] pm_untime: fil to wak up
[   0.362032]hdmi_msm dmi_msm.1 externalcommon_stte_create sysfs grup de39e68                                                                   
[    0362673] Iside writback_drivr_init                                                                                                         
[   0.36275] Insidewritebackprobe                                                                                                               
[    1.244803] TZCOM: unable to get bus clk                                                                                                     
[    1.431680] cm36651_setup_reg: initial proximity value = 3                                                                                   
[    1.549671] msm_otg msm_otg: request irq succeed for otg_power                                                                               
[    1.566702] mms_ts 3-0048: [TSP] ISC Ver [0xbb] [0x20] [0x20]                                                                                
[    1.571341] mms_ts 3-0048: [TSP] fw is latest. Do not update.                                                                                
[    1.583488] [__s5c73m3_probe:3818] S5C73M3 probe                                                                                             
[    1.587089] [s5c73m3_sensor_probe_cb:3793] Entered                                                                                           
[    1.591942] [s5c73m3_i2c_probe:3675] Entered                                                                                                 
[    1.596123] [s5c73m3_init_client:3381] Entered                                                                                               
[    1.600579] [s5c73m3_i2c_probe:3695] Exit                                                                                                    
[    1.604608] [s5c73m3_sensor_probe:3726] Entered                                                                                              
[    1.609095] [s5c73m3_spi_init:226] Entered                                                                                                   
[    1.613154] [s5c73m3_spi_probe:191] Entered                                                                                                  
[    1.617335] [s5c73m3_spi_probe:201] s5c73m3_spi successfully probed                                                                          
[    1.623561] [s5c73m3_sensor_probe :  3749] Probe_done!!                                                                                      
[    1.672638] mmc0: No card detect facilities available                                                                                        
[    1.682984] aat1290a_led_probe : Probe                                                                                                       
[    1.693850] msm_soc_platform_init                                                                                                            
[    1.697298] msm_afe_afe_probe                                                                                                                
[    1.843064] msm_asoc_pcm_new                                                                                                                 
[    1.849748] msm_asoc_pcm_new                                                                                                                 
[    2.023134] set_dload_mode <1> ( c00176d4 )                                                                                                  
[    2.052220] cypress_touchkey 16-0020: Touchkey FW Version: 0x06                                                                              
[    2.123851] init: /init.qcom.rc: 466: invalid command '/system/bin/log'                                                                      
[    2.129620] init: /init.qcom.rc: 573: ignored duplicate definition of service 'sdcard'                                                       
[    2.137402] init: /init.qcom.rc: 586: ignored duplicate definition of service 'ftm_ptt'                                                      
[    2.145490] init: /init.target.rc: 73: ignored duplicate definition of service 'thermald'                                                    
[    2.154677] init: could not open /dev/keychord                                                                                               
[    2.239951] init: Device Encryption status is (0)!!                                                                                          
[    2.243705] init: [disk_config] :::: fsck -> /dev/block/mmcblk0p15 (ext4):::::                                                               
[    2.251823] init: [disk_config] ext_check -> /system/bin/e2fsck -v -y /dev/block/mmcblk0p15                                                  
[    2.588921] init: [disk_config] ext_check ->ok                                                                                               
[    2.611597] init: [disk_config] :::: fsck -> /dev/block/mmcblk0p17 (ext4):::::                                                               
[    2.617762] init: [disk_config] ext_check -> /system/bin/e2fsck -v -y /dev/block/mmcblk0p17                                                  
[    2.655333] init: [disk_config] ext_check -> ok                                                                                              
[    2.664947] init: [disk_config] :::: fsck -> /dev/block/mmcblk0p11 (ext4):::::                                                               
[    2.671081] init: [disk_config] ext_check -> /system/bin/e2fsck -v -y /dev/block/mmcblk0p11                                                  
[    2.704532] init: [disk_config] ext_check -> ok                                                                                              
[    3.259056] init: cannot find '/system/etc/install-recovery.sh', disabling 'flash_recovery'                                                  
[    3.270471] init: cannot find '/system/bin/dmbserver', disabling 'dmb'

External UART log from battery-pull and reinsert
Code:
[1630] AST_POWERON
[    0.000000] heap->name mm, mb->start c0000000
[    0.000000] Reserving memory at address ea000000 size: 100000
[    0.000000] sec_dbg_setup: str=@0x88d90004
[    0.000000] sec_dbg_setup: secdbg_paddr = 0x88d90004
[    0.000000] sec_dbg_setup: secdbg_size = 0x40000
[    0.000000] etb_buf_setup: str=@0x8fffb9c0
[    0.000000] etb_buf_setup: secdbg_paddr = 0x8fffb9c0
[    0.000000] etb_buf_setup: secdbg_size = 0x4000
[    0.174484] rdev_init_debugfs: Error-Bad Function Input
[    0.174851] AXI: msm_bus_fabric_init_driver(): msm_bus_fabric_init_driver
[    0.176926] sec_debug_init: enable=0
[    0.177445] sc_debug_iit: restat_reason  0xdf0086c
[    0216206] [sm8960_int_cam:299]setting one!!
[   0.217915 select_req_plan:ACPU PVS:Nominal
    0.25206] i2c ic-14: Invaid 7-bit 2C addres 0x00
[   0.25207] i2c i2-14: Can'tcreate deice at 0x0
[    0252250] 2c i2c-19 Failed t register 2c clientcmc624 at0x38 (-16
[    0252250] ic i2c-19: an't creae device t 0x38
[   0.25243] rdev_iit_debugs: Error-Bd Functio Input
[   0.25292] max895 19-0060:DVS modesdisabled ecause VI0 and VID do not hve propercontrols.
                                                                                           [    0.29536] msmetm msm_em: ETM trcing is nt enable!
[    0.35797] pm_rntime: fal to wakeupllcation tale not intialized
[    .362093] dmi_msm hmi_msm.1:external_ommon_stae_create:sysfs grop de39e60                                                                   
[    0.62734] Inide writeack_driverinit                                                                                                         
[   0.36285] Inside riteback_robe                                                                                                               
[    1.244803] TZCOM: unable to get bus clk




possible exploitations
Possible entry point MODEM - Someone with a JTAG setup test viability of modifying a single byte on /dev/block/mmcblk0p1
Possible entry point PARAMS - Samsung stores their boot parameters in PARAMS partition. It may be possible to modify PARAMS for insecure boot
Possible entry point BOOT - Modify CMDLINE parameter to load information from another location.
Possible entry point BOOT - We may be able to shove an insecure bootloader into memory, boot into that, and then use the recovery partition as our kernel partition. Bauwks 2nd U-Boot. U-Boot is available for the Exynos 4412, we need to find one for Qualcomm.
Possible entry point SYSTEM - It may be possible to use a 2nd init hack from this partition to load custom kernels into memory and reboot the kernel.


Current tasks
What do all of these partitions do?
Do we have a SDCard based recovery?
Where can we find an Odin3 CSC Flash?
Testing methods above is required
 
Last edited:

kzoak82

Senior Member
Jan 27, 2011
221
27

Attachments

  • translate.jpg
    translate.jpg
    198.4 KB · Views: 9,195

papi92

Senior Member
Nov 15, 2009
2,434
1,565
What I am looking into is the upload mode available in Odin. It has no signature checks from what I can tell. Also do you mean a stock Odin file which we do have.

Sent from my SCH-I535 using Tapatalk 2
 

rothnic

Senior Member
Aug 18, 2010
811
278
Adam, appreciate you keeping us up to date. As an electrical/systems engineer the journey is great learning experience for me and all.

I'm not sure if you've come across this document. It talks about the MSM7xxx series security capabilities. I couldn't find one for the MSM8xxx, but this may give some insight into how Qualcomm approaches security.

MSM7xxx

Edit: Looks like you are aware of the concepts from your reference about IBL,PBL,SBL.
 
Last edited:

Quize

Member
Feb 17, 2010
15
13
Not sure if this will be any help, but found this regarding the blast kernel:

http://www.anyclub.org/2012/06/how-to-add-more-physical-ram-memory.html

how to add more physical RAM memory section to Blast Kernel in the MDM9200/MDM9600
Blast Kernel has the capability to take more than one contiguous physical RAM space (section) and use it for its own system memory. In order to add more RAM mem section to Blast, the customer need to modify blast_config.c file.

Here is the example of adding 4MB additional RAM mem section.

In blast_config.c,

struct phys_mem_pool_config pool_configs[] __attribute__((weak)) = {
{"DEFAULT_PHYSPOOL", //name
{
{0x00c00000, 0x02f00000}, // 47MB, the first mem section
{0x00700000, 0x00400000} // adding 4MB, QC default value is {0}
}
},


In this example, additional 4MB is added starting from 0x700000 physical address offset.
Please note the start address has to be physical address.
By adding the second mem section, the Blast Kernel can now use 51MB in total, while it used only 47MB before adding the 4MB mem section

Found this http://code.google.com/p/blastkernel/ (locked down though, I couldn't get access) which was linked from here (also in french but translated through google) but I'm unsure as to if it is related to the blastkernel you are looking for as all the links for the source code are now broken.


Also, while looking through the vz source I found that the person responsible for a lot the vzw specific code also helped to develop this http://www.uclinux.org/ so maybe some of that source might be of some help too.
 
  • Like
Reactions: B_rock and E:V:A

AdamOutler

Retired Senior Recognized Developer
Feb 18, 2011
5,224
9,827
Miami, Fl̨̞̲̟̦̀̈̃͛҃҅͟orida
There are relatively large pins between the processor and the other larger chip on the back side of the board. I'm not sure what I'm looking at, but it's definitely communications of some kind. These were taken with the battery out of the device when plugged into USB. Each set starts a new unplug-plugin sequence.

Code:
:�0�0�0
          �0
            �0
              �0
                �0��0
                     �0
                       �0��0
                            �0��0
                                 �0
                                   �0
                                     �0
                                       �0��0
                                            �0
                                              �0
                                                �0
                                                  �0
                                                    �0
                                                      �0
                                                        �0
                                                          �0��0�0
                                                                  �0
                                                                    �0
                                                                      �0
                                                                        �0      
                                                                          �0    
                                                                            �0 x

:�0�0�0
          �0
            �0
              �0
                �0��0
                     �0��0
                          �0
                            �0
                              �0
                                �0
                                  �0��0
                                       �0
                                         �0
                                           �0
                                             �0
                                               �0
                                                 �0
                                                   �0
                                                     �0
                                                       �0��0
                                                            �0
                                                              �0
                                                                �0
                                                                  �0            
                                                                    �0��0       
                                                                         �0     
                                                                           �0  z
                                                                             �0
p























:�0�0�0
          �0
            �0
              �0��0
                   �0�0
                        �0
                          �0
                            �0
                              �0
                                �0
                                  �0��0
                                       �0
                                         �0
                                           �0
                                             �0
                                               �0
                                                 �0
                                                   �0
                                                     �0
                                                       �0
                                                         �0
                                                           �0
                                                             �0
                                                               �0               
                                                                 �0             
                                                                   �0��0        
                                                                        �0      
                                                                          �0   �
                                                                            �0�


This is from another pin on the back. As soon as plugged in, a series of 2's come out at 115200BPS:
Code:
22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222

Here's another one:

Code:
2"DB"D""D""D""D""D""B""B""B""B"DB"DB"DB"D""D""D""D""D""B""B""B""B"DB"DB"DB"D""D""D""D""D""B""B""B""B"DB"DB"DB"D""D""D""D""D""B""B""B""B"DB"DB"DB"D""D""D""D""D""B""B""B""B"DB"DB"DB"D""D""D""D""D""B""B""B""B"DB"DB"DB"D""D""D""D""D""�

All of these were located between the processor and SDCard. I must examine these bettter. In particular, there are two points at the corner of the processor just above where my needle is located in this picture.
Code:
U��UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU�UUU��JUU��UUUU��UUU��Z���UUUU���UUUUU���UUUUUU���UUUU���UUUUUUٙ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

These points seem to be what I'm looking for. as far as UART.. Especially that last one. It moves just as you'd expect start-up checks to move, random strings of characters... While not intelligable in the above, after figuring out the bitrate I'm sure something will come through.
IMG_20120713_205222.jpg


I need to analyze the bitrate at this point. I'm quitting for the night though.


I am at the wrong baud rate, but I think I pulled up some valuable boot data from the processor.
 
Last edited:

Rebellos

Senior Recognized Developer
May 13, 2009
1,353
3,428
Gdańsk
Just a sidenote - some of these testpoints might be CLK/PWM signals, the one with serie of "2222" seems like this.
Also - if UART coming out of FSA muxer is 115200bps - the same debug line, on testpoint before FSA must be aswell 115200bps. Unless bootloader output goes to other port with different baud rate, which sounds unlikely.
 

AdamOutler

Retired Senior Recognized Developer
Feb 18, 2011
5,224
9,827
Miami, Fl̨̞̲̟̦̀̈̃͛҃҅͟orida
Just a sidenote - some of these testpoints might be CLK/PWM signals, the one with serie of "2222" seems like this.
Also - if UART coming out of FSA muxer is 115200bps - the same debug line, on testpoint before FSA must be aswell 115200bps. Unless bootloader output goes to other port with different baud rate, which sounds unlikely.

You're right about the 2's.. it's probly a sync signal or something....ie...
Code:
00000010

However, I don't believe the UART is all consistant. Here's my reasoning. Samsung does not control the processor or the initial bootloader on the processor. I've spoken to some engineers and they are frustrated because things must be sent to Qualcomm to get work done on the bootloaders. It's highly likely that they simply change the bps of the UART to match the Samsung standard.

Thanks to Josh Groce at MobileTechVideos for the heads up on this trick: I was able to mount the Qualcomm Modem partition which I also belive to be the PBL as a FAT partition
Code:
adam@adam-Desktop:~/Desktop/VZWGS3$ sudo mount ./0p1 ./p1
adam@adam-Desktop:~/Desktop/VZWGS3$ ls -l ./p1
total 16
drwxr-xr-x 2 root root 16384 Jul  5  2011 image
adam@adam-Desktop:~/Desktop/VZWGS3$ ls -l ./p1/image
total 42464
-rwxr-xr-x 1 root root      244 Jun 15 08:33 dsps.b00
-rwxr-xr-x 1 root root      160 Jun 15 08:33 dsps.b01
-rwxr-xr-x 1 root root   147456 Jun 15 08:33 dsps.b02
-rwxr-xr-x 1 root root    31872 Jun 15 08:33 dsps.b03
-rwxr-xr-x 1 root root     6220 Jun 15 08:33 dsps.b04
-rwxr-xr-x 1 root root    13824 Jun 15 08:33 dsps.b05
-rwxr-xr-x 1 root root      404 Jun 15 08:33 dsps.mdt
-rwxr-xr-x 1 root root      180 Jun 15 07:50 dxhdcp2.b00
-rwxr-xr-x 1 root root     6520 Jun 15 07:50 dxhdcp2.b01
-rwxr-xr-x 1 root root   135168 Jun 15 07:50 dxhdcp2.b02
-rwxr-xr-x 1 root root     2100 Jun 15 07:50 dxhdcp2.b03
-rwxr-xr-x 1 root root     6700 Jun 15 07:50 dxhdcp2.mdt
-rwxr-xr-x 1 root root      308 Jun 15 08:33 modem.b00
-rwxr-xr-x 1 root root     6600 Jun 15 08:33 modem.b01
-rwxr-xr-x 1 root root 21960368 Jun 15 08:33 modem.b02
-rwxr-xr-x 1 root root  4962049 Jun 15 08:33 modem.b03
-rwxr-xr-x 1 root root  1358104 Jun 15 08:33 modem.b04
-rwxr-xr-x 1 root root    72208 Jun 15 08:33 modem.b06
-rwxr-xr-x 1 root root   707124 Jun 15 08:33 modem.b07
-rwxr-xr-x 1 root root     1044 Jun 15 08:25 modem_f1.b00
-rwxr-xr-x 1 root root     7060 Jun 15 08:25 modem_f1.b01
-rwxr-xr-x 1 root root     2676 Jun 15 08:25 modem_f1.b02
-rwxr-xr-x 1 root root   954800 Jun 15 08:25 modem_f1.b03
-rwxr-xr-x 1 root root   575208 Jun 15 08:25 modem_f1.b04
-rwxr-xr-x 1 root root   246484 Jun 15 08:25 modem_f1.b05
-rwxr-xr-x 1 root root    94208 Jun 15 08:25 modem_f1.b06
-rwxr-xr-x 1 root root    13568 Jun 15 08:25 modem_f1.b07
-rwxr-xr-x 1 root root    11212 Jun 15 08:25 modem_f1.b08
-rwxr-xr-x 1 root root     9548 Jun 15 08:25 modem_f1.b09
-rwxr-xr-x 1 root root    68223 Jun 15 08:25 modem_f1.b10
-rwxr-xr-x 1 root root   113468 Jun 15 08:25 modem_f1.b13
-rwxr-xr-x 1 root root   164412 Jun 15 08:25 modem_f1.b14
-rwxr-xr-x 1 root root     3604 Jun 15 08:25 modem_f1.b21
-rwxr-xr-x 1 root root    28156 Jun 15 08:25 modem_f1.b22
-rwxr-xr-x 1 root root    19136 Jun 15 08:25 modem_f1.b23
-rwxr-xr-x 1 root root    74360 Jun 15 08:25 modem_f1.b25
-rwxr-xr-x 1 root root    49740 Jun 15 08:25 modem_f1.b26
-rwxr-xr-x 1 root root    84476 Jun 15 08:25 modem_f1.b29
-rwxr-xr-x 1 root root     1064 Jun 15 08:25 modem_f1.fli
-rwxr-xr-x 1 root root     8104 Jun 15 08:25 modem_f1.mdt
-rwxr-xr-x 1 root root     1044 Jun 15 08:25 modem_f2.b00
-rwxr-xr-x 1 root root     7060 Jun 15 08:25 modem_f2.b01
-rwxr-xr-x 1 root root     2676 Jun 15 08:25 modem_f2.b02
-rwxr-xr-x 1 root root   955792 Jun 15 08:25 modem_f2.b03
-rwxr-xr-x 1 root root   579032 Jun 15 08:25 modem_f2.b04
-rwxr-xr-x 1 root root   239892 Jun 15 08:25 modem_f2.b05
-rwxr-xr-x 1 root root    94208 Jun 15 08:25 modem_f2.b06
-rwxr-xr-x 1 root root    13568 Jun 15 08:25 modem_f2.b07
-rwxr-xr-x 1 root root    11212 Jun 15 08:25 modem_f2.b08
-rwxr-xr-x 1 root root     9580 Jun 15 08:25 modem_f2.b09
-rwxr-xr-x 1 root root    68223 Jun 15 08:25 modem_f2.b10
-rwxr-xr-x 1 root root   116188 Jun 15 08:25 modem_f2.b13
-rwxr-xr-x 1 root root   158012 Jun 15 08:25 modem_f2.b14
-rwxr-xr-x 1 root root     3604 Jun 15 08:25 modem_f2.b21
-rwxr-xr-x 1 root root    28156 Jun 15 08:25 modem_f2.b22
-rwxr-xr-x 1 root root    19200 Jun 15 08:25 modem_f2.b23
-rwxr-xr-x 1 root root    74360 Jun 15 08:25 modem_f2.b25
-rwxr-xr-x 1 root root    49756 Jun 15 08:25 modem_f2.b26
-rwxr-xr-x 1 root root    84476 Jun 15 08:25 modem_f2.b29
-rwxr-xr-x 1 root root     1064 Jun 15 08:25 modem_f2.fli
-rwxr-xr-x 1 root root     8104 Jun 15 08:25 modem_f2.mdt
-rwxr-xr-x 1 root root     6908 Jun 15 08:33 modem.mdt
-rwxr-xr-x 1 root root      276 Jun 15 08:24 q6.b00
-rwxr-xr-x 1 root root     6580 Jun 15 08:24 q6.b01
-rwxr-xr-x 1 root root  3447760 Jun 15 08:24 q6.b03
-rwxr-xr-x 1 root root  1653278 Jun 15 08:24 q6.b04
-rwxr-xr-x 1 root root   757840 Jun 15 08:24 q6.b05
-rwxr-xr-x 1 root root    14472 Jun 15 08:24 q6.b06
-rwxr-xr-x 1 root root     6856 Jun 15 08:24 q6.mdt
-rwxr-xr-x 1 root root      180 Jun 15 07:50 tzapps.b00
-rwxr-xr-x 1 root root     6520 Jun 15 07:50 tzapps.b01
-rwxr-xr-x 1 root root   503808 Jun 15 07:50 tzapps.b02
-rwxr-xr-x 1 root root      452 Jun 15 07:50 tzapps.b03
-rwxr-xr-x 1 root root     6700 Jun 15 07:50 tzapps.mdt
-rwxr-xr-x 1 root root      212 Jun 15 07:44 wcnss.b00
-rwxr-xr-x 1 root root      140 Jun 15 07:44 wcnss.b01
-rwxr-xr-x 1 root root     8360 Jun 15 07:44 wcnss.b02
-rwxr-xr-x 1 root root  1778532 Jun 15 07:44 wcnss.b04
-rwxr-xr-x 1 root root      352 Jun 15 07:44 wcnss.mdt
adam@adam-Desktop:~/Desktop/VZWGS3$
 
Last edited:

jcase

Retired Forum Mod / Senior Recognized Developer
Feb 20, 2010
6,308
15,761
Raleigh NC
tz - is the trustzone, normal qualcomm
cache - should not be the dalvik cache, dalvik cache should be on teh userdata partition now on. (Could be wrong, dont have the device). Cache should be almost strictly for updates and recovery use now.

boot itself is signed, not the zImage.

I believe hopping on the developer device is a better option, not only is it made for such, it's also not purchasing a phone within Verizon's sales network (my favorite part of it all)
 
Last edited:

alexmason

Senior Member
Sep 21, 2010
61
15
Anderson, IN
But google slapped on the GPLv3 i believe. And since GPL allows multiple licenses then the TIVO clause would still apply. Correct me if I am wrong.
 

tpike

Senior Member
In the uart dump in the op, the line stamped at 1.57 seems interesting. Looks like the modem (assuming that's still where the activity is going on then) is checking firmware. Makes me think that there might be something there that could be captured. I wonder where it is confirming the fw is updated.

This might not be useful, but it seems interesting.

Sent from my SCH-I535 using Xparent ICS Tapatalk 2
 

papi92

Senior Member
Nov 15, 2009
2,434
1,565
Why not try the Samsung flash utility instead of Odin.

Sent from my SCH-I535 using Tapatalk 2
 

E:V:A

Inactive Recognized Developer
Dec 6, 2011
1,447
2,222
-∇ϕ
In the uart dump in the op, the line stamped at 1.57 seems interesting. Looks like the modem (assuming that's still where the activity is going on then) is checking firmware.

Usually the firmware is loaded and checked in modem by modem RTOS kernel. But I don't know what modem (BP/CP) is used in the Verizon S3...
 

ExodusC

Senior Member
Mar 29, 2010
298
57
Errata to OP:

/efs partition on qualcomm models is as far as i know empty (not used)
Many people on the forums here have stated IMEI information is stored in a file within /efs (at least on GSM models?) but I can't confirm myself.

There are several threads about attempting to restore lost IMEIs that might have more info.
 

AdamOutler

Retired Senior Recognized Developer
Feb 18, 2011
5,224
9,827
Miami, Fl̨̞̲̟̦̀̈̃͛҃҅͟orida
I was playing around with Odin3. I'm a Linux guy so this was exploration for me.... I was able to make my own Odin package with signed Samsung images under Linux and flash it with Odin3 under Windows.

Code:
adam@adam-Desktop:~/Desktop/Untitled Folder$ tar  -cf OdinCustom.tar recovery.img boot.img 
adam@adam-Desktop:~/Desktop/Untitled Folder$ md5sum -t OdinCustom.tar >> OdinCustom.tar
adam@adam-Desktop:~/Desktop/Untitled Folder$ mv ./OdinCustom.tar ./OdinCustom.tar.md5
adam@adam-Desktop:~/Desktop/Untitled Folder$

The first command create a TAR (Tape ARchive format) of a recovery.img and a boot.img in a file called OdinCustom.tar. Then appends the MD5 to the end of the package. The third command renames it to OdinCustom.tar.md5. The resulting file is flashable by Odin.

This could prove useful if we can find another Qualcomm device which has a bootloader signed by Samsung.

Also, Odin3 has a cool inf file which can be modified to change the title and characteristics of Odin3 http://i49.tinypic.com/352q7t0.png

I found something in the qualcomm bootloader (first partition which is a fat32 and appears to be unsigned) in the tzapps.b02 file which may or may not be of use. apparently they are looking for something called "/file/file.dat" and it contains dummy data for executive test suite. May be a possible exploit.


Also, this is a very important excerpt from the Qualcomm manual mentioned earlier... http://www.scribd.com/doc/51789612/80-V9038-15-APPLICATION-NOTE-MSM7XXX-QFUSES-AND-SECURITY

Code:
The PBL performs the following functions during a cold boot:
■Performs the minimal hardware setup required for PBL execution
■Reads off-chip boot configuration data from the flash memory
■Processes configuration data setting up clocks and memory access based on this data
■Loads the QCSBL image from the flash memory into the RAM
■Authenticates the QCSBL image if authentication is enabled
■Branches execution to the QCSBL image

Reads off-chip boot configuration data from the flash memory!

I spent a lot of time tonight looking at the individual files on the MODEM partition. I got nowhere except to possibly add a test file I mentioned above. It was alot of data to go through. that MODEM is 60 megs!

So, I started loooking at the SBL1 file. Now, it appears that this file runs linearly and tells a story as it goes through...

Code:
adam@adam-Desktop:~/Desktop/VZWGS3$ strings ./0p2|head -n 200
: 2q
: 4q
`" 2q
: 4q
: 4q
(R '
(R '
(R '
~}|{zyxwvvutsrqqponnmllkjjihhgffeddccbaa``__^^]]\\[[ZZYYXXWWVVUUUTTSSRRRQQPPPOOONNMMMLLLKKKJJJIIIHHHGGGGFFFEEEDDDDCCCCBBBBAAA
/!( 
/!(0
/!(0
/!( 
SDCC4 HAL v2.0.1
boot_error_handler.c
*0@-
*p@-
*p@-
*p@-
*p@-
*p@-
*8@-
boot_pbl_authenticator.c
boot_clobber_prot.c
boot_clobber_prot_local.c
boot_clobber_prot.c
boot_clobber_prot_local.c
boot_config.c
boot_config.c
*Image Loaded by %s, Start on 0x%x
Data Abort
boot_mc.c
boot_error_handler.c
*BOOT
SCL_SBL1_STACK_BASE-SCL_SBL1_STACK_SIZE
boot_error_handler.c
boot_flash_dev_if.c
boot_flash_dev_if.c
boot_flash_dev_if.c
boot_flash_dev_sdcc_if.c
boot_flash_dev_sdcc_if.c
boot_flash_dev_sdcc.c
boot_flash_init, Start
boot_flash_init, Delta
boot_flash_target.c
boot_flash_trans_sdcc.c
*p@-
boot_flash_trans_sdcc.c
boot_fota_restore_partition, Start
boot_fota_restore_partition, Delta
boot_fota_restore_partition, Start
restore_fota_partition fail
boot_fota_restore_partition, Delta
boot_error_handler.c
boot_error_handler.c
boot_loader.c
*p@-
*p@-
boot_pbl_authenticator.c
boot_pbl_v1.c
boot_pbl_v1.c
boot_pbl_v1.c
Prefetch Abort
boot_error_handler.c
boot_rollback_version.c
boot_flash_dev_sdcc.c
boot_error_handler.c
Undefined
boot_flash_dev_sdcc.c
boot_flash_dev_sdcc.c
boot_flash_dev_sdcc.c
boot_flash_dev_sdcc.c
boot_flash_dev_sdcc.c
boot_sdcc_hotplug.c
EFI PART
%sp%lu
%sh%d
%s%c%lu
*p@-
boot_sdcc_hotplug.c
boot_sdcc_hotplug.c
read fail
*hdev open fail: fota
hdev open fail: dest
size fail: src
size fail: too big
read fail: src
read fail: dest
write fail: signature clear
*p@-
*p@-
*p@-
*p@-
*p@-
*|@-
boot_sdcc_hotplug.c
%sp%lu
*8@-
*p@-
SBL1, End
SBL1, Delta
*p@-
sbl1_check_device_temp, Start
sbl1_check_device_temp, Delta
sbl1_hw.c
sbl1_hw_init, Start
sbl1_hw_init, Delta
*SBL1, Start
scatterload_region && ram_init, Start
*scatterload_region && ram_init, Delta
sbl1_mc.c
sbl1_mc.c
*p@-
*0@-
*p@-
*{%u} 
 n;^
Qkkbal
i]Wb
9a&g
MGiI
wn>Jj
#.zf
+o*7
0123456789ABCDEF@0X
0123456789abcdef@0x
SBL2 Image Loaded, Delta
SBL1
DSP1
RAMFS1
SBL2
DSP2
RAMFS2
SBL3
ADSP_Q5
NONE
NANDPRG
NORPRG
HASH
QCSBL
FSBL
OSBL
APPSBL
OEM_SBL
EHOSTDL
APPS_KERNEL
BACKUP_RAMFS
APPS
AMSS
SSD_KEYS
fs_hotplug_api.c
Assertion phy_hdev != NULL failed
boot_flash_trans_sdcc
boot_flash_trans_sdcc_factory
boot_flash_dev_sdcc
HAL_SBI_SSBI_V2_PMIC_ARBITER
fs_hotplug_iter.c
Assertion 0 failed
fs_hotplug_legacy_hdev.c
Assertion phy_hdev->legacy_hdev != NULL failed
fs_hotplug_partition.c
Assertion parti->is_locked == 0 failed
Assertion parti->is_formatting == 0 failed
Assertion parti->is_locked == 1 failed
Assertion parti->is_formatting == 1 failed
Assertion parti->ref_cnt >= 1 failed
Assertion hdev_name != NULL failed
Assertion parti != NULL failed
fs_hotplug_dev_state.c
Assertion phy_hdev->dev_state == HPDEV_UNDISCOVERED failed
Assertion phy_hdev->dev_state == HPDEV_DISCOVERED failed
Assertion phy_hdev->dev_state == HPDEV_UNMOUNTED failed
Assertion phy_hdev->dev_state == HPDEV_UNINITIALIZED || phy_hdev->dev_state == HPDEV_LOCKED || phy_hdev->dev_state == HPDEV_FORMATTING || phy_hdev->dev_state == HPDEV_UNMOUNTED failed
Assertion phy_hdev->dev_state == HPDEV_MOUNTED failed
Assertion phy_hdev->dev_state == HPDEV_UNINITIALIZED failed
fs_hotplug_poll.c
Assertion phy_hdev->bdev_handle == NULL failed
Assertion phy_hdev->parti_list == NULL failed
Assertion phy_hdev->hdev_list == NULL failed
fs_blockdev_devnull_driver.c
Assertion devnull_ops != NULL failed
/hdev/dev.null
BDEV_DEVNULL_DRIVER
BDEV_SD_DRIVER
/hdev/sdc1
/hdev/sdc2
/hdev/sdc3
/hdev/sdc4
fs_blockdev_sd_driver.c
Assertion sdcc_ops != NULL failed
fs_hotplug_parser.c
Assertion blk_cnt != 0 failed
fs_blockdev_sd.c
Assertion sd_data != NULL failed
Assertion handle != NULL failed
Assertion sdcc_handle != NULL failed
Assertion bytes_per_block != NULL failed
Assertion blocks != NULL failed
Assertion bdev != NULL failed
Assertion dev->driveno < max_sd_slots failed
@@@@@@@@@AAAAA@@@@@@@@@@@@@@@@@@
          
Format: Log Type - Time(microsec) - Message
Log type: B - since boot(excluding boot rom).  D - delta
 OVERFLOW
........

Particularly "boot_fota_restore_partition, Start". It looks like one of the first things the GS3 does is check for information to be updated on FOTA partition. Whatever it choses to do, it performs security checks on the size, and a few other things.

I believe it then loads SBL2 as the rest of the partitions do not have this message.. "SBL2 Image Loaded, Delta".


SBL2:
Code:
adam@adam-Desktop:~/Desktop/VZWGS3$ strings ./0p3
SVC: R1-R14
FIQ:R13-R14
IRQ:R13-R14
UND:R13-R14
ABT:R13-R14
SYS:R13-R14
 pGp@-
K{DiF
K{DiF
D(b(F
hu)AF
019Ud
3F*F!F@F
G j@
&_F F
h/F F
fJF)F F&`NF
F 9"
pJpO
: 4q
: 6q
: 8q
! 6q
`" 2q
: 4q
pG	hJ
G j@
 bNE
G j@
G j@
 j8D b F
02:Ud
3F*F!F@F
CreT
#L|D
!L|D
F)F F
5EC/
 x0(
02bUm
#\b\cTI
FAF F
F!h	
 b h
G jv
G j@
G j@
 ,pp
2F!F
G j@
1JzD
2FhF
2FiF
: 4q
: 6q
: 8q
bF9FN
RAIAK
bF9FN
RAIAK
bF9FN
~}|{zyxwvvutsrqqponnmllkjjihhgffeddccbaa``__^^]]\\[[ZZYYXXWWVVUUUTTSSRRRQQPPPOOONNMMMLLLKKKJJJIIIHHHGGGGFFFEEEDDDDCCCCBBBBAAA
! 3[B
.p@-
.p@-
SDCC4 HAL v2.0.1
 pGxG
.boot_error_handler.c
.0@-
.p@-
.p@-
.p@-
.p@-
.p@-
.boot_auth_if.c
.boot_auth_if.c
.boot_sbl_authenticator.c
.boot_clobber_prot.c
.boot_clobber_prot_local.c
boot_clobber_prot.c
boot_clobber_prot_local.c
boot_config_data_table_init, Start
.boot_config_data_table_init, Delta
.boot_config.c
.boot_config.c
.Image Loaded by %s, Start on 0x%x
Data Abort
Ufw}3{
O*2PC~
wwwwp@-
.boot_mc.c
.0:ALL
.boot_error_handler.c
.BOOT
SCL_SBL2_STACK_BASE-SCL_SBL2_STACK_SIZE
.boot_error_handler.c
.boot_flash_dev_if.c
.boot_flash_dev_if.c
.boot_flash_dev_if.c
.boot_flash_dev_sdcc_if.c
.boot_flash_dev_sdcc_if.c
.boot_flash_dev_sdcc.c
boot_flash_init, Start
boot_flash_init, Delta
.boot_flash_target.c
.boot_flash_trans_sdcc.c
.p@-
.boot_flash_trans_sdcc.c
.boot_hash.c
.boot_hash_if.c
.boot_hash_if.c
.boot_sys_loader.c
.boot_error_handler.c
.boot_error_handler.c
.boot_loader.c
.boot_loader.c
.boot_logger_ram.c
.p@-
.p@-
BRPMSignal SBL1 to Jump to RPM FW
.boot_sys_loader.c
.boot_pbl_v1.c
.boot_pbl_v1.c
.boot_pbl_v1.c
.boot_pbl_v1.c
Prefetch Abort
.boot_error_handler.c
.boot_rollback_version.c
.boot_sbl_authenticator.c
.boot_flash_dev_sdcc.c
.p@-
.boot_ddr_info.c
.boot_sbl_authenticator.c
.boot_error_handler.c
Undefined
.p@-
.p@-
.p@-
.p@-
RDDL
Testing DDR Read/Write.
.Testing DDR Read/Write: Memory map.
Testing DDR Read/Write: Data lines.
Testing DDR Read/Write: Address lines.
Testing DDR Read/Write: Own-address algorithm.
Testing DDR Read/Write: Walking-ones algorithm.
Testing DDR Deep Power Down.
Testing DDR Deep Power Down: Entering deep power down.
Testing DDR Deep Power Down: In deep power down.
Testing DDR Deep Power Down: Exiting deep power down.
Testing DDR Deep Power Down: Read/write pass.
Testing DDR Self Refresh.
.Testing DDR Self Refresh: Write pass.
Testing DDR Self Refresh: Read pass.
Testing DDR Self Refresh: Entering self refresh.
Testing DDR Self Refresh: In self refresh.
Testing DDR Self Refresh: Exiting self refresh.
.boot_flash_dev_sdcc.c
.boot_flash_dev_sdcc.c
.boot_flash_dev_sdcc.c
.boot_flash_dev_sdcc.c
.boot_flash_dev_sdcc.c
.p@-
.CDT
.Error: Platform ID EEPROM is not programmed
boot_config_data.c
.boot_sdcc_hotplug.c
.0@-
EFI PART
%sp%lu
%sh%d
%s%c%lu
.p@-
.boot_sdcc_hotplug.c
.boot_sdcc_hotplug.c
.p@-
.p@-
.p@-
.p@-
.p@-
.p@-
.p@-
.|@-
.boot_sdcc_hotplug.c
%sp%lu
.p@-
.p@-
.p@-
	0!0
.0@-
RPM loading is successful.
cancel RPM loading!
SBL2, End
SBL2, Delta
.sbl2_hw.c
sbl2_hw_init, Start
sbl2_hw_init, Delta
sbl2_hw_init_secondary, Start
h/w version : %d
sbl2_hw_init_secondary, Delta
.SBL2, Start
scatterload_region & ram_init, Start
.scatterload_region & ram_init, Delta
.sbl2_mc.c
sbl2_retrieve_shared_info_from_sbl1, Start
.sbl2_retrieve_shared_info_from_sbl1, Delta
.sbl2_mc.c
.0@-
.sbl2_config.c
.p@-
.boot_hash.c
.p@-
.p@-
.p@-
.0@-
.SHA256
.p@-
LOGM
.{%u} 
Tz Execution, Start
Tz Execution, Delta
pG	B
0pGO
!pGO
sbl2_ddr_init
DalEnv
TargetCfg
 SHA1
DEBUG
SW_ID
HW_ID
OEM_ID
SHA256
 n;^
Qkkbal
i]Wb
9a&g
MGiI
wn>Jj
#.zf
+o*7
DEV_SDC1
DEV_SDC2
DEV_SDC3
DEV_SDC4
CHAN_SDC1
CHAN_SDC2
CHAN_SDC3
CHAN_SDC4
0123456789ABCDEF@0X
0123456789abcdef@0x
SBL3 Image Loaded, Delta
RPM Image Loaded, Delta
TZ Image Loaded, Delta
boot_auth
boot_hash
SBL1
DSP1
RAMFS1
SBL2
DSP2
RAMFS2
SBL3
ADSP_Q5
NONE
NANDPRG
NORPRG
HASH
QCSBL
FSBL
OSBL
APPSBL
OEM_SBL
EHOSTDL
APPS_KERNEL
BACKUP_RAMFS
APPS
AMSS
SSD_KEYS
fs_hotplug_api.c
Assertion phy_hdev != NULL failed
boot_flash_trans_sdcc
boot_flash_trans_sdcc_factory
boot_flash_dev_sdcc
fs_hotplug_iter.c
Assertion 0 failed
fs_hotplug_legacy_hdev.c
Assertion phy_hdev->legacy_hdev != NULL failed
fs_hotplug_partition.c
Assertion parti->is_locked == 0 failed
Assertion parti->is_formatting == 0 failed
Assertion parti->is_locked == 1 failed
Assertion parti->is_formatting == 1 failed
Assertion parti->ref_cnt >= 1 failed
Assertion hdev_name != NULL failed
Assertion parti != NULL failed
fs_hotplug_dev_state.c
Assertion phy_hdev->dev_state == HPDEV_UNDISCOVERED failed
Assertion phy_hdev->dev_state == HPDEV_DISCOVERED failed
Assertion phy_hdev->dev_state == HPDEV_UNMOUNTED failed
Assertion phy_hdev->dev_state == HPDEV_UNINITIALIZED || phy_hdev->dev_state == HPDEV_LOCKED || phy_hdev->dev_state == HPDEV_FORMATTING || phy_hdev->dev_state == HPDEV_UNMOUNTED failed
Assertion phy_hdev->dev_state == HPDEV_MOUNTED failed
Assertion phy_hdev->dev_state == HPDEV_UNINITIALIZED failed
fs_hotplug_poll.c
Assertion phy_hdev->bdev_handle == NULL failed
Assertion phy_hdev->parti_list == NULL failed
Assertion phy_hdev->hdev_list == NULL failed
fs_blockdev_devnull_driver.c
Assertion devnull_ops != NULL failed
/hdev/dev.null
BDEV_DEVNULL_DRIVER
BDEV_SD_DRIVER
/hdev/sdc1
/hdev/sdc2
/hdev/sdc3
/hdev/sdc4
fs_blockdev_sd_driver.c
Assertion sdcc_ops != NULL failed
fs_hotplug_parser.c
Assertion blk_cnt != 0 failed
fs_blockdev_sd.c
Assertion sd_data != NULL failed
Assertion handle != NULL failed
Assertion sdcc_handle != NULL failed
Assertion bytes_per_block != NULL failed
Assertion blocks != NULL failed
Assertion bdev != NULL failed
Assertion dev->driveno < max_sd_slots failed
@@@@@@@@@AAAAA@@@@@@@@@@@@@@@@@@
          
Format: Log Type - Time(microsec) - Message
Log type: B - since boot(excluding boot rom).  D - delta
 OVERFLOW
AT24C128BN
:Hg~
D{L0
*gRn
0D,l}
b=Fe-+
gW6y
South Korea1
Suwon City1
Samsung Corporation1
DMC1#0!
Samsung AttestationCA cert1%0#
android.os@samsung.com0
120614224636Z
320609224636Z0
KR1!0
Samsung Attestation CERT1
Suwon City1
Samsung Corporation1
South Korea1
04 0000 OEM_ID1%0#
android.os@samsung.com1
05 0001E0C8 SW_SIZE1
06 0000 MODEL_ID1
07 0001 SHA2561"0 
01 0000000000000005 SW_ID1"0 
02 006B10E100000000 HW_ID1"0 
03 0000000000000000 DEBUG0
y$_$
[OLW'}
Q^<T
&#xk#
z0x0:
3010/
)http://crl.qdst.com/crls/qctdevattest.crl0
6p5o
%e>I`
<dQ=#
South Korea1
Suwon City1
Samsung Corporation1
DMC1
Samsung Root CA cert1%0#
android.os@samsung.com0
120412114438Z
320407114438Z0
South Korea1
Suwon City1
Samsung Corporation1
DMC1#0!
Samsung AttestationCA cert1%0#
android.os@samsung.com0
&bMb
%pWj\
`0^0
#7ie
?f{M
South Korea1
Suwon City1
Samsung Corporation1
DMC1
Samsung Root CA cert1%0#
android.os@samsung.com0
120412114438Z
320407114438Z0
South Korea1
Suwon City1
Samsung Corporation1
DMC1
Samsung Root CA cert1%0#
android.os@samsung.com0
U)_|e}f
^AZp
<0:0
v)BT
zd0u
=j[P
As for SBL2. It looks like it starts up, performs security checks, then it can jump to "RPM" partition ", "RPM loading is successful.
cancel RPM loading!, .BRPM", "Signal SBL1 to Jump to RPM FW", This may be Odin, or some other undiscovered mode I'm not sure yet and it looks like "ABOOT" is actually Odin's partition... What is RPM?

It then executes "TZ" or "Trust Zone" which I need to do some reading on...

More to come later. It's late and I need to get some rest.
 
Last edited by a moderator:

alquimista

Senior Member
Mar 20, 2008
218
118
Los Angeles
{i} PARAMS

possible exploitations
Possible entry point PARAMS - Samsung stores their boot parameters in PARAMS partition. It may be possible to modify PARAMS for insecure boot
The PARAMS partition (from an adb dump) contains almost all 0's. Here are the first 32 bytes
(layed out in hex offsets of 0x00000000 && 0x00000010):
Code:
00000000  01 00 00 00 00 00 00 00  00 00 00 00 01 00 00 00
00000010  01 00 00 00 01 00 00 00  00 00 00 00 00 00 00 00
From what I understand, each occurance of 01 indicates a boot_mode variable that the SBL reads*. The rest of the file, about 10,485,739bytes of data, can contain information for other variables such as debug_level and switch_sel and maybe more, but I have too look more into dissembling the SBL patition image (sbl2.img) to see what other variables there are. I'll report back as soon as I have any more info on that.

*See this link for more info on the param.blk:
http://epiccm.blogspot.com/p/stock-firmware.html

I think its interesting that from an adb dump, BOOT, EFS, FOTA and PARAMS are all the same size. Only BOOT and PARAMS contain any data though. EFS and FOTA must be loaded from the BOOT partition depending on the boot variables loaded in the PARAMS partition, but I may be wrong on that.

As for booting from SDcard here's a link on how it was done with the Epic 4G:
http://epiccm.blogspot.com/2012/01/multiboot-android-for-debuggingtesting.html
The instructions seem like they should work, especially since they had to use kexec to load from the SDcard and the SGS3 will have to do the same for now. I haven't built this yet, but I will give it a go as soon as I have a spare moment.
EDIT: this might be what you're looking for as far as booting from SD --> http://xdaforums.com/showthread.php?t=1774795 END EDIT

I am currently manually going through each hex offset in IDA and seaching for commands to disassemble aboot.img, I haven't gotten very far as this is extremely time intensive.

I can post any dissasm DB's that anyone wants. They can get rather large though.

On a side note, I'm using IDAPro6.1 for disassembly of the adb dumped partitions. If you have any pointers on using IDA for debugging/disassembling android partitions, that would be fantastic. I have an arm toolchain, but beyond that IDA I've only had experience poking at Window$ crap.

Ta,
ALQI
 
Last edited:

alquimista

Senior Member
Mar 20, 2008
218
118
Los Angeles
recovery kernel log

The recovery kernel log is in this path:
/data/log/recovery_kernel_log.txt​
I'd post it in a code section here but it's just too long.
There's a few other interesting logs in that path as well.

As I understand it, this seems to be the log from the kernel loaded during the bootloader/Odin mode boot. Could reveal some of the variables set in the params partition. Plus it has juicy hex offsets for all kinds of things.

It's quite verbose.

K sleepy time now.
Ta,
ALQI
 
Status
Not open for further replies.

Top Liked Posts

  • There are no posts matching your filters.
  • 561
    Verizon GS3 is now Bootloader UNLOCKED.
    We now have access to an unsecure bootloader. This was leaked by an African-Canadian Sock Monkey.

    Let me make this clear. If Samsung updates your device's bootloaders, using this tool could potentially brick your device. Once you apply this, never accept a factory update without first flashing the Odin Packages in the Original Post of this thread. As a general rule, you want to be the last guy to apply any Samsung update. Run custom.

    As of the date of this posting, this works great on Linux and it should work wonderfully on Mac too. NOTE: this may work on windows, but please, windows users.. learn to use your computer before you ask questions on XDA-Developers. This is one-click on Linux and Mac every darn time. If you're using Windows, I recommend downloading Windows Ubuntu Installer(WUBI) to install Ubuntu from within Windows.

    Download
    http://d-h.st/ypJ


    Instructions:
    1. Open this file
    2. Select Root with DebugFSRoot and Do It
    3. Select Flash Unsecure Aboot and Do It
    4. Use Odin or CWM to flash kernels to your device

    1zqwmlc.png

    To flash from device without the above tool:
    • root your device
    • Download this link to your /sdcard/Downloads/ folder: http://d-h.st/Piq
    • Type this in the terminal emulator
      Code:
      su -c dd if=/sdcard/Downloads/aboot.img of=/dev/block/mmcblk0p5

    This was tested with a Sprint kernel flashed via Odin. Although the Sprint kernel caused the device to have a blank screen due to hardware incompatibility, it's more than enough for a proof-of-concept. Stock bootloaders will not let you flash improper kernels with Odin and will cause the device not to boot. This corrects the problem. I'll leave implementation to other developers. If you feel uncomfortable flashing this on your own, wait for your favorite kernel developer to release something.

    Note to developers: This CASUAL package contains everything you need. A jar can be opened as a zip file. CASUAL format sticks all scripts in the /SCRIPTS/ folder. You can obtain all files needed from within this package, then repackage them into CWM format. In order to avoid a mass brick fest, please apply an assert to your CWM scripts to verify ro.build.version.incremental and do not allow updates past what has been tested. As of the time of this writing I535VRALG7B is safe.

    With the unlock of the GS3, this thread is locked. There will be no victory dancing in here. Move along to General or something. This thread will lie dormant until it is needed again in the future. Ralekdev will be releasing another exploit in the future as soon as this one stops working. Feel free to review what was learned until then.

    P.S. Sorry to those who I have offended by having posts removed. I'm also sorry to those who had their intelligence insulted before I had both of our posts removed. I hope you understand that in 6 months from now when everyone forgets about this thread but needs to catch back up, the information will still be right here in condensed format.
    173
    Rules:
    Do not post in here unless you have something constructive to say. "Thanks", "Hey this is wonderful", and any other comments like that are not wanted. They take up space and make it more difficult to find information. I'm requesting that this thread be heavily moderated. In order to work efficiently, information density must be kept high. We are all guilty of adding in a few off-topic sentances from time-to-time, but this thread is strictly business and I expect the moderators to moderate me as well.

    What is this?
    This is the place where we can research and develop a method to unlock the bootloader of the Verizon Galaxy SIII. Hopefully, this will be development at its finest.


    Why not just buy a developer edition
    GTFO! Not a single person got started developing by buying a developer phone. They started developing because they were unhappy with the features of their device and wanted something better. They wanted something more. This developer phone is a tax on developer innovation. We do not stand for that. We will break the security and we will enable XDA-Developers to do what they do best.

    Until security is broken and available for everyone, this device will get updates last, users will be unhappy because there are no additional features and Samsung violates the spirit of Open Source and copyright laws. Take a look at the bottom line of GPL-Violations.org FAQ located here: http://gpl-violations.org/faq/sourcecode-faq.html


    What are the goals?
    • Attain a bootloader recovery - 75% JTAG (the extra 25% will be for a user-friendly method)
      The Galaxy S3 is bootable from SDCard. In case of emergency this is needed. We need to verify that this works on the Verizon GS3 to bring up Odin. This will set up infrastructure for research.
    • Attain a full stock restoration via Odin or Heimdall - 90%
      For use with Odin3.
      Bootloader - BOOTLOADER_I535VRALF2_618049_REV09_user_low_ship.tar.md5 - 1.97 MB - Thanks nbsdx
      PDA - SCH-I535_VZW_1_20120705143513_fti2qg2lmf.zip
      NEED CSC PACKAGE (MODEM, PARAMS and Other Miscellaneous partitions). This is enough to recover a device though.
      To include bootloaders and recovery to a working and stock condition with the EMMC wiped entirely. Heimdall is a work in progress for this device. This will complete the infrastructure needed for research.
    • Collect information
      This will be the longest and most difficult part of this development. The information provided by Qualcomm is not readily available. Samsung is notoriously secretive about their bootloaders. Mainly we, as a community, will generate information. Please post any relevant datasheets, theory-of-operation, or manuals which you can find.
    • Provide a way to remove security checks from Odin3.] 100% - insecure aboot.img which may break in the future
      By removing security checks from Odin3 on the computer or the Loki daemon on the device we can flash anything through Odin or Heimdall.
    • Provide a way to bypass security checks within bootloaders. 200% we have two exploits, only one has been released.
      This is the ultimate goal. Once we can bypass the security checks, kernels can be flashed giving us the control required to develop


    Initial information
    [BOOTLOADER] Locked bootloader research and news: http://xdaforums.com/showthread.php?t=1756919


    My own research

    SBL1 is the first booting partition. Qualcomm provides the Modem partition so it comes first on the EMMC. SBL1 is the first bootloader and that is specified by Qualcomm standards. Qualcom mmake sthe primitive bootloader and allows their customers (Samsung) to make a Secondary bootloader. Samsung chose to use three secondary bootloaders.

    The following 0p* are located in /dev/block/mmcblk*

    0p1 = modem
    Built by se.infra
    HUDSON_GA_D2_USA-VZW-HARDKEY-PROD-USER
    I take this to mean this Qualcomm modem was built in Hudson Georgia.
    I was not able to find signatures on this block :). This does NOT mean that there are no signatures on this block. The file is 33 megs. The file is unencrypted.
    The modem uses the BLAST Kernerl ver : 02.04.02.02.00 Unfortunately we need someone who speaks French(???) to understand how this works http://blast.darkphpbb.com/faq.php
    Judging by the contents of this file, it is an operating system of it's own including keyboard, mouse and a lot of debugging information. We need to find out more about the BLAST Kernel and this partition.


    Samsung Proprietary partitions SBL1,2,3
    Overall I'm not entirely familiar with this new 3 SBL setup. If someone could help me out, that would be great. This 3 SBL setup looks like they tried to adapt (slopily) their IBL+PBL+SBL setup to the Qualcomm and added overhead.

    op2=sbl1
    This block is signed by Samsung, we will not be able to modify it.
    Some Strings we expect to see on UART are:

    0p3=sbl2
    This block is signed by Samsung, we will not be able to modify it.

    Some of the strings we may see over UART are:
    Code:
    RPM loading is successful.
    cancel RPM loading!
    SBL2, End
    SBL2, Delta
    .sbl2_hw.c
    sbl2_hw_init, Start
    sbl2_hw_init, Delta
    sbl2_hw_init_secondary, Start
    h/w version : %d
    sbl2_hw_init_secondary, Delta
    .SBL2, Start
    scatterload_region & ram_init, Start
    .scatterload_region & ram_init, Delta
    .sbl2_mc.c
    sbl2_retrieve_shared_info_from_sbl1, Start
    .sbl2_retrieve_shared_info_from_sbl1, Delta

    0p4=sbl3
    This block is signed by Samsung, we will not be able to modify it.

    Possibly useful information:
    SVC: R1-R14
    FIQ:R13-R14
    IRQ:R13-R14
    UND:R13-R14
    ABT:R13-R14
    SYS:R13-R14

    This block appears to be a full OS of its own. I'm not sure of its purpose.

    op5= aboot
    This block is signed by Samsung, we will not be able to modify it

    This block contains HTML information. It would appear that it is possible to put the device into a mode where it will provide a webserver which displays state information.

    This block appears to be a complete operating system

    This block contains the Loke Daemon which communicates with Odin3.


    0p6= rpm
    This block is signed by Samsung we will not be able to modify it

    0p7= boot
    This is the kernel. There are several things we can do here... I belive this package itself is not signed, but the zImage itself is... here is the bootimg.cfg file

    Code:
    adam@adam-Desktop:~/Desktop/VZWGS3$ cat ./bootimg.cfg 
    bootsize = 0xa00000
    pagesize = 0x800
    kerneladdr = 0x80208000
    ramdiskaddr = 0x81500000
    secondaddr = 0x81100000
    tagsaddr = 0x80200100
    name = 
    cmdline = console=null androidboot.hardware=qcom user_debug=31

    It may be possible to use that cmdline variable as an exploit.




    0p8= tzTrust Zone
    0p9= pad
    0p10= param -boot mode parameters - this could be a potential exploitation point.
    0p11= efs -serial numbers
    I've honestly got no clue about most of the following partitions.
    0p12= modemst1
    0p13= modemst2
    0p14= system - Android stuff
    0p15= userdata - App Stuff
    0p16= persist
    0p17= cache - Storage for updates
    0p18= recovery - recovery partition
    0p19= fota
    0p20= backup
    0p21= fsg
    0p22= ssd
    0p23= grow

    External UART log from initial power up:
    Code:
    [1630] AST_POWERON
    [    0.000000] heap->name mm, mb->start c0000000
    [    0.000000] Reserving memory at address ea000000 size: 100000
    [    0.000000] sec_dbg_setup: str=@0x88d90004
    [    0.000000] sec_dbg_setup: secdbg_paddr = 0x88d90004
    [    0.000000] sec_dbg_setup: secdbg_size = 0x40000
    [    0.000000] etb_buf_setup: str=@0x8fffb9c0
    [    0.000000] etb_buf_setup: secdbg_paddr = 0x8fffb9c0
    [    0.000000] etb_buf_setup: secdbg_size = 0x4000
    [    0.174515] rdev_init_debugfs: Error-Bad Function Input
    [    0.174881] AXI: msm_bus_fabric_init_driver(): msm_bus_fabric_init_driver
    [    0.176957] sec_debug_init: enable=0
    [    0.177475] ec_debug_nit: restrt_reason: 0xdf0085c
    [    .216358] msm8960_iit_cam:292]settingdone!!
    [    0.25006] i2c 2c-14: Inalid 7-bi I2C addrss 0x00
        0.25237] i2c ic-14: Can' create evice at x00
    [   0.252220]i2c i2c-1: Failed o registeri2c clien cmc624 t 0x38 (-6)
    [    .252250] 2c i2c-19:Can't crete deviceat 0x38
        0.25433] rdevinit_debufs: Error-ad Functin Input
        0.25222] max892 19-006: DVS mode disabledbecause VD0 and VI1 do not ave prope control.
    [    0.79536] ms_etm msm_tm: ETM tacing is ot enable beacaussec_debug s not enaled!
    [   0.284449 smd_chanel_probe_orker: alocation tble not iitialized
                                                                      [    0.38766] pm_untime: fil to wak up
    [   0.362032]hdmi_msm dmi_msm.1 externalcommon_stte_create sysfs grup de39e68                                                                   
    [    0362673] Iside writback_drivr_init                                                                                                         
    [   0.36275] Insidewritebackprobe                                                                                                               
    [    1.244803] TZCOM: unable to get bus clk                                                                                                     
    [    1.431680] cm36651_setup_reg: initial proximity value = 3                                                                                   
    [    1.549671] msm_otg msm_otg: request irq succeed for otg_power                                                                               
    [    1.566702] mms_ts 3-0048: [TSP] ISC Ver [0xbb] [0x20] [0x20]                                                                                
    [    1.571341] mms_ts 3-0048: [TSP] fw is latest. Do not update.                                                                                
    [    1.583488] [__s5c73m3_probe:3818] S5C73M3 probe                                                                                             
    [    1.587089] [s5c73m3_sensor_probe_cb:3793] Entered                                                                                           
    [    1.591942] [s5c73m3_i2c_probe:3675] Entered                                                                                                 
    [    1.596123] [s5c73m3_init_client:3381] Entered                                                                                               
    [    1.600579] [s5c73m3_i2c_probe:3695] Exit                                                                                                    
    [    1.604608] [s5c73m3_sensor_probe:3726] Entered                                                                                              
    [    1.609095] [s5c73m3_spi_init:226] Entered                                                                                                   
    [    1.613154] [s5c73m3_spi_probe:191] Entered                                                                                                  
    [    1.617335] [s5c73m3_spi_probe:201] s5c73m3_spi successfully probed                                                                          
    [    1.623561] [s5c73m3_sensor_probe :  3749] Probe_done!!                                                                                      
    [    1.672638] mmc0: No card detect facilities available                                                                                        
    [    1.682984] aat1290a_led_probe : Probe                                                                                                       
    [    1.693850] msm_soc_platform_init                                                                                                            
    [    1.697298] msm_afe_afe_probe                                                                                                                
    [    1.843064] msm_asoc_pcm_new                                                                                                                 
    [    1.849748] msm_asoc_pcm_new                                                                                                                 
    [    2.023134] set_dload_mode <1> ( c00176d4 )                                                                                                  
    [    2.052220] cypress_touchkey 16-0020: Touchkey FW Version: 0x06                                                                              
    [    2.123851] init: /init.qcom.rc: 466: invalid command '/system/bin/log'                                                                      
    [    2.129620] init: /init.qcom.rc: 573: ignored duplicate definition of service 'sdcard'                                                       
    [    2.137402] init: /init.qcom.rc: 586: ignored duplicate definition of service 'ftm_ptt'                                                      
    [    2.145490] init: /init.target.rc: 73: ignored duplicate definition of service 'thermald'                                                    
    [    2.154677] init: could not open /dev/keychord                                                                                               
    [    2.239951] init: Device Encryption status is (0)!!                                                                                          
    [    2.243705] init: [disk_config] :::: fsck -> /dev/block/mmcblk0p15 (ext4):::::                                                               
    [    2.251823] init: [disk_config] ext_check -> /system/bin/e2fsck -v -y /dev/block/mmcblk0p15                                                  
    [    2.588921] init: [disk_config] ext_check ->ok                                                                                               
    [    2.611597] init: [disk_config] :::: fsck -> /dev/block/mmcblk0p17 (ext4):::::                                                               
    [    2.617762] init: [disk_config] ext_check -> /system/bin/e2fsck -v -y /dev/block/mmcblk0p17                                                  
    [    2.655333] init: [disk_config] ext_check -> ok                                                                                              
    [    2.664947] init: [disk_config] :::: fsck -> /dev/block/mmcblk0p11 (ext4):::::                                                               
    [    2.671081] init: [disk_config] ext_check -> /system/bin/e2fsck -v -y /dev/block/mmcblk0p11                                                  
    [    2.704532] init: [disk_config] ext_check -> ok                                                                                              
    [    3.259056] init: cannot find '/system/etc/install-recovery.sh', disabling 'flash_recovery'                                                  
    [    3.270471] init: cannot find '/system/bin/dmbserver', disabling 'dmb'

    External UART log from battery-pull and reinsert
    Code:
    [1630] AST_POWERON
    [    0.000000] heap->name mm, mb->start c0000000
    [    0.000000] Reserving memory at address ea000000 size: 100000
    [    0.000000] sec_dbg_setup: str=@0x88d90004
    [    0.000000] sec_dbg_setup: secdbg_paddr = 0x88d90004
    [    0.000000] sec_dbg_setup: secdbg_size = 0x40000
    [    0.000000] etb_buf_setup: str=@0x8fffb9c0
    [    0.000000] etb_buf_setup: secdbg_paddr = 0x8fffb9c0
    [    0.000000] etb_buf_setup: secdbg_size = 0x4000
    [    0.174484] rdev_init_debugfs: Error-Bad Function Input
    [    0.174851] AXI: msm_bus_fabric_init_driver(): msm_bus_fabric_init_driver
    [    0.176926] sec_debug_init: enable=0
    [    0.177445] sc_debug_iit: restat_reason  0xdf0086c
    [    0216206] [sm8960_int_cam:299]setting one!!
    [   0.217915 select_req_plan:ACPU PVS:Nominal
        0.25206] i2c ic-14: Invaid 7-bit 2C addres 0x00
    [   0.25207] i2c i2-14: Can'tcreate deice at 0x0
    [    0252250] 2c i2c-19 Failed t register 2c clientcmc624 at0x38 (-16
    [    0252250] ic i2c-19: an't creae device t 0x38
    [   0.25243] rdev_iit_debugs: Error-Bd Functio Input
    [   0.25292] max895 19-0060:DVS modesdisabled ecause VI0 and VID do not hve propercontrols.
                                                                                               [    0.29536] msmetm msm_em: ETM trcing is nt enable!
    [    0.35797] pm_rntime: fal to wakeupllcation tale not intialized
    [    .362093] dmi_msm hmi_msm.1:external_ommon_stae_create:sysfs grop de39e60                                                                   
    [    0.62734] Inide writeack_driverinit                                                                                                         
    [   0.36285] Inside riteback_robe                                                                                                               
    [    1.244803] TZCOM: unable to get bus clk




    possible exploitations
    Possible entry point MODEM - Someone with a JTAG setup test viability of modifying a single byte on /dev/block/mmcblk0p1
    Possible entry point PARAMS - Samsung stores their boot parameters in PARAMS partition. It may be possible to modify PARAMS for insecure boot
    Possible entry point BOOT - Modify CMDLINE parameter to load information from another location.
    Possible entry point BOOT - We may be able to shove an insecure bootloader into memory, boot into that, and then use the recovery partition as our kernel partition. Bauwks 2nd U-Boot. U-Boot is available for the Exynos 4412, we need to find one for Qualcomm.
    Possible entry point SYSTEM - It may be possible to use a 2nd init hack from this partition to load custom kernels into memory and reboot the kernel.


    Current tasks
    What do all of these partitions do?
    Do we have a SDCard based recovery?
    Where can we find an Odin3 CSC Flash?
    Testing methods above is required
    96
    I have heard, but do not know, that there may be plans to get one of the developer phones into Adam's hands to extract from. That may provide insight into how to disable Qualcomm Secure Boot no? Anyone care to shed some light on if this is still planned or not? Thanks

    I don't need another device. I want all of the partitions from a developer device and I'd like to work with someone who has one. Remote access via "WirelessADB" and the device set to be in the "DMZ" of a router would be sufficient for all tests I would need to do.

    Just as an update, I'm slowly getting back to work. For those who were wondering, I packed up everything and moved. I have my stuff 90% set up. I'm just getting back on it. I'm working on compiling all of the Verizon GS3 exploits into a single CASUAL one-click package. Root, recovery, Busybox, Basic Hacking Tools.

    Once I've got a CASUAL package put together I'll go through and read this thread again from start to finish and figure out what needs work... my mind is totally off-topic right now after a move. Time to get back to work. I hope to have some big news at the end of next week.
    85
    It's been a few days so I wanted to give an update on the signature check on boot.img

    As has been previously guessed, everything important in boot.img is included in the signature check

    page_size is always 0x800 since we're using emmc boot

    hash_size = 0x800 (read the first page with the boot_img_header)
    hash_size += page_size * ((page_size + ramdisk_size - 1) / page_size)
    hash_size += page_size * ((page_size + kernel_size - 1) / page_size)
    hash_size += page_size * ((page_size + second_size - 1) / page_size)

    For the stock boot.img, this should come out to be 0x573000, so the first 0x573000 bytes in boot.img are checked.

    These bytes are then SHA1 hashed and passed to the verification function

    After hash_size bytes is a series of 0x100 byte blocks that will be passed to the verification function (img_sig_data parameter below)

    The verification function uses the following structure

    Code:
    struct sig_ctx_t {
    	int count;
    	int seed[65];
    	int subcheck_seed[64]; // possibly a modulus
    }

    This sig_ctx is located in aboot.img at file offset 0x12642C in VRALF2 and VRALG1 (It'll start with bytes 0x40, 0x00, 0x00, 0x00)

    I've cleaned up the first function a bit from what IDA/Hex-Rays spit out, but the second function I haven't simplified as much

    Code:
    int signature_check_data(sig_ctx_t *sig_ctx, char *img_sig_data, signed int signature_len, char *sha1_of_contents) {
    
    	int* img_ofs_0x100 = (int*)(img_sig_data + 0x100);
    	int* img_ofs_0x200 = (int*)(img_sig_data + 0x200);
    	int* img_ofs_0x300 = (int*)(img_sig_data + 0x300);
    	int* img_ofs_0x400 = (int*)(img_sig_data + 0x400); // Temporary storage
    
    	// Copy 0x0 block to 0x100
    	memcpy(img_ofs_0x100, &img_sig_data[0], signature_len);
    
    	// ofs_0x200 is filled with byte-swapped ints from img_ofs_0x100
    	for (int i = 0; i < sig_ctx->count; i++) {
    		img_ofs_0x200[i] =  htonl(img_ofs_0x100[sig_ctx->count - 1 - i]);
    	}
    
    	// subcheck(sig_block *block, int *output, int *input1, int *input2)
    	// multiplication maybe?
    	signature_subcheck(sig_ctx, img_ofs_0x300, img_ofs_0x200, sig_ctx->subcheck_seed);
    	signature_subcheck(sig_ctx, img_ofs_0x400, img_ofs_0x300, img_ofs_0x300);
    	signature_subcheck(sig_ctx, img_ofs_0x300, img_ofs_0x400, img_ofs_0x200);
    
    	if ( sig_ctx->count )
    	{
    		count_minus_1 = sig_ctx->count - 1;
    		v18 = img_ofs_0x300[sig_ctx->count - 1];
    		v19 = sig_ctx->seed[sig_ctx->count]; // seed[64]
    		// v19 = *(&sig_ctx->count + sig_ctx->count + 1);
    		if ( v18 >= v19 )
    		{
    			if ( v18 == v19 )
    			{
    				for (int i = 0; i < sig_ctx->count; i++) {
    					int v22 = img_ofs_0x300[sig_ctx->count - 1 - i];
    					int v23 = sig_ctx->seed[sig_ctx->count - 1 - i];
    					if (v22 < v23) {
    						goto LABEL_18
    					}
    				}
    			}
    			if ( sig_ctx->count > 0 )
    			{
    				int carry = 0;
    				for (int i = 0; i < sig_ctx->count; i++) {
    					uint64 temp = img_ofs_0x300[i] - (uint64)sig_ctx->seed[i + 1];
    					img_ofs_0x300[i] = img_ofs_0x300[i] - sig_ctx->seed[i + 1] + carry;
    					carry = (int)(temp >> 32); // get high 32 bits
    				}
    			}
    		}
    
    		LABEL_18:
    		// Store the calculation back into img_ofs_0x100
    		for (int i = 0; i < sig_ctx->count; i++) {
    			int val = img_ofs_0x300[sig_ctx->count - 1 - i];
    			char* dest = &img_ofs_0x100[i];
    
    			dest[0] = (val & 0xFF000000) >> 24;
    			dest[1] = ((val & 0x00FF0000) >> 16) & 0xFF;
    			dest[2] = ((val & 0x0000FF00) >> 8) & 0xFF;
    			dest[3] = (val & 0xFF);
    		}
    
    		if (memcmp(img_ofs_0x100, sig_check_compare_result, 236)) // sig_check_compare_result is a char[236] with the first 2 bytes 0x00, 0x01, and the rest 0xFF
    			return 0;
    
    		if (signature_len > 236) {
    			if (memcmp(&img_ofs_0x100[236], sha1_of_contents, signature_len - 236)) // 256-236 = 20
    				return 0;
    
    			// Signature passed
    			return 1;
    		}
    	}
    	return 0;
    }


    Here's the subcheck function, it looks like arbitrary-precision math, possibly mulmod

    Code:
    void __fastcall signature_subcheck(sig_ctx_t *sig_data, int *output, int *input1, int *input2)
    {
      int v5; // r3@2
      int count; // r4@3
      unsigned __int64 v7; // r2@6
      unsigned __int64 v8; // r8@6
      int inner_index; // r5@7
      int block1_pos; // r4@7
      int v11; // r5@14
      __int64 v12; // r8@14
      int v13; // r6@14
      unsigned __int64 v14; // r2@15
      int v15; // kr04_4@15
      int v16; // [sp+18h] [bp-48h]@6
      unsigned int v17; // [sp+1Ch] [bp-44h]@6
      int outer_index; // [sp+2Ch] [bp-34h]@5
    
      if ( sig_data->count > 0 )
      {
        v5 = 0;
        do
        {
          output[v5++] = 0;                         // this do while is just memset(output, 0, 4 * sig_data->count)
          count = sig_data->count;
        }
        while ( sig_data->count > v5 );
        if ( count > 0 )
        {
          outer_index = 0;
          do
          {
            v16 = input1[outer_index];
            v7 = (unsigned int)v16 * (unsigned __int64)(unsigned int)*input2 + (unsigned int)*output;// v7 = input1[outer_index] * (uint64)input2[0] + output[0]
            v17 = sig_data->seed[0] * v7;
            v8 = sig_data->seed[1] * (unsigned __int64)v17 + (unsigned int)v7;
            if ( count <= 1 )
            {
              block1_pos = 1;
            }
            else
            {
              inner_index = 0;
              block1_pos = 1;
              do
              {
                v7 = (unsigned int)v16 * (unsigned __int64)(unsigned int)input2[block1_pos]
                   + (unsigned int)output[block1_pos]
                   + HIDWORD(v7);
                v8 = sig_data->seed[inner_index + 2] * (unsigned __int64)v17 + HIDWORD(v8) + (unsigned int)v7;
                ++block1_pos;
                output[inner_index] = v8;
                ++inner_index;
              }
              while ( block1_pos < sig_data->count );
            }
            output[block1_pos - 1] = HIDWORD(v8) + HIDWORD(v7);
            if ( (HIDWORD(v8) + (unsigned __int64)HIDWORD(v7)) >> 32 )
            {
              if ( sig_data->count <= 0 )
                return;
              v11 = 0;
              v12 = 0LL;
              v13 = 0;
              do
              {
                v14 = (unsigned int)output[v11] - (unsigned __int64)sig_data->seed[v11 + 1];
                v15 = output[v11] - sig_data->seed[v11 + 1];
                output[v11] = output[v11] - sig_data->seed[v11 + 1] + v12;
                count = sig_data->count;
                ++v13;
                ++v11;
                v12 = (signed int)((__PAIR__(HIDWORD(v14), v15) + v12) >> 32);
              }
              while ( v13 < sig_data->count );
            }
            else
            {
              count = sig_data->count;
            }
            ++outer_index;
          }
          while ( outer_index < count );
        }
      }
    }


    The goal is to make it so that after all the calculations the 256 byte block located at img_sig_data+0x100 has the contents 0x00, 0x01, 0xFF * 236, and then the sha1 of our boot.img

    I'm in the middle of moving at the moment, so I don't have as much time as I would like to look at this right now, but that should clear up in a few days.

    Also, if there's any interest I can post a guide on how to get the bootloader files loaded into IDA for analysis. Some knowledge of ARM assembly would be required though.

    EDIT:

    In other news, I found what keeps resetting the 16 byte encrypted romtype in param.img. It's libcordon.so, which is from /system/app/SysScope.apk (it'll also be copied to /system/lib/libcordon.so). It's using quite a few checks to see if you've modified your system.

    There's an adb scanner, checking to see if you've changed the ro.secure or ro.debuggable props.

    The root process scanner checks running processes and returns true if any are found running as root that are not one of:
    "debuggerd", "init", "installd", "servicemanager", "vold", "zygote", "netd", "ueventd", "dock_kbd_attach", "pppd", "pppd_runner", "mpdecision", "thermald", "hdmid", "sec_keyboard", "seccmmond", "mfsc", "mfdp"

    There's also a partition check, kernel checker, su scanner, and a file scanning mechanism using data from a sqlite db

    So to completely remove the Samsung custom screen on bootup and 5 second delay you'd need to disable the SysScope.apk, then encrypt and write the 16 bytes yourself using 0xFF000000 as the first int to mark yourself as official
    70
    A gentleman named Lee contacted me via email. He said he has 0 posts so he could not post in here. This post contains his email to me. I am not wrapping it in quotes because quotes are destroyed in future posts. This is literally the best development we've had in this thread.



    ------email from Lee------
    I've been looking at the bootloader in aboot.img the past day or so and wanted to contribute what I know about the param.img partition and how it's used. I've been following the thread at xda, but since my account has 0 posts I can't actually post this in that thread.

    Please note these are a little rough around the edges, just things I jotted down while reverse engineering.

    param.img Structure

    At offset 0 there's an 88 byte structure I've called the header

    struct param_header {
    int status; // need to investigate more. some relationships between this and boot modes. 4 == firmware error int unk_04; // haven't seen this used anywhere int unk_08; // haven't seen this used anywhere int emmc_checksum_attempted; int emmc_checksum_ok; int nvdata_backup; // says whether we have a backup of modemst1 in "fsg" partition and a backup of modemst2 in "backup" partition?
    int unk_18[16]; // haven't seen this used anywhere };

    status (NEEDS WORK):
    1 = ?
    2 = boot_mode 3?
    3 = recovery?
    4 = boot_mode 1 - fastboot. displays "firmware update issue" image
    5 = boot_mode 4?


    at offset 0x900000 there's a structure controlling some debug variables

    struct param_debug {
    int debug_level;
    int unk_04; // 4 in dumps. haven't seen this used anywhere int unk_08; // 0 in dumps. haven't seen this used anywhere int emmc_checksum_attempted; // mirror of param_header.emmc_checksum_attempted
    int emmc_checksum_ok; // mirror of param_header.emmc_checksum_ok };

    About param_debug.debug_level:
    It has 3 possible values, and it changes some flags are passed to the kernel.
    DLOW is the default, but some features like ramdump mode only work on DMID or DHIG

    1. 0x574F4C44 (DLOW) - Low debug setting strcat(boot_img_hdr->cmdline, " androidboot.debug_level=0x4f4c");// OL strcat(boot_img_hdr->cmdline, " sec_debug.enable=0"); strcat(boot_img_hdr->cmdline, " sec_debug.enable_user=0");

    2. 0x44494D44 (DMID) - Mid-level debugging strcat(boot_img_hdr->cmdline, " androidboot.debug_level=0x494d");// IM strcat(boot_img_hdr->cmdline, " sec_debug.enable=1"); strcat(boot_img_hdr->cmdline, " sec_debug.enable_user=0");

    3. 0x47494844 (DHIG) - Full debugging
    strcat(boot_img_hdr->cmdline, " androidboot.debug_level=0x4948");// IH strcat(boot_img_hdr->cmdline, " sec_debug.enable=1"); strcat(boot_img_hdr->cmdline, " sec_debug.enable_user=1"); strcat(boot_img_hdr->cmdline, " slub_debug=FPUZ");

    Check drivers/misc/sec_misc.c for what these values do for the kernel


    At offset 0x9FFC00 (sizeof(param.img) - 0x400 is how the offset is calculated by the BL):
    Here are 16 bytes unique to each device, and they are part of what determines whether or not you have a custom rom.

    It's AES128 encrypted using a key made from the emmc's psn and some static data

    Key generation:
    First, the 4byte psn is expanded to 8 bytes

    char first_half[14];
    snprintf(first_half, 13, "%08x", mmc_get_psn()); memcpy(aes_initial_key, first_half, 8);

    The second half is calculated based on all static data

    char custom_check_index_shuf_table[] = { 1, 3, 2, 4, 5, 1, 0, 4, 4, 5, 4, 0 }; char custom_check_table[] = { 0x40, 0x74, 0x25, 0x61, 0x21, 0x74, 0x70, 0x62, 0x62, 0x24, 0x33, 0x5E }; char romtype_enc_key_buf[32];

    char* custom_check_shuffle_calc(signed int always_199, int count) { int out_index; // r3@2 int last_index; // r2@2 int odd_index; // r4@3 int table_index; // r2@3 char table_value;

    if ( count <= 0 )
    {
    out_index = 0;
    }
    else
    {
    out_index = 0;
    last_index = 0;
    do
    {
    odd_index = always_199 & 1;
    always_199 >>= 1;
    table_index = odd_index + 2 * last_index; table_value = custom_check_table[table_index]; last_index = custom_check_index_shuf_table[table_index];
    romtype_enc_key_buf[out_index++] = table_value; } while ( out_index != count ); } romtype_enc_key_buf[out_index] = 0; return romtype_enc_key_buf; }

    This function is used like this (the parameters are always 199 and 8 in the vzw aboot):
    char* second_half = custom_check_shuffle_calc(199, 8); memcpy(&aes_initial_key[8], second_half, 8);

    Now we have 16 bytes in aes_initial_key, but it's shuffled again with the following function

    char custom_check_final_index_table[] = { 0, 4, 5, 0xD, 3, 8, 0xE, 9, 0xA, 2, 1, 7, 0xB, 6, 0xC, 0xF }; void custom_check_shuffle_final_key(char *iv, char *final) { int v2; // r3@1 int v5; // r3@3

    v2 = 0;
    do
    {
    final[custom_check_final_index_table[v2]] = iv[v2];
    v2++;
    }
    while ( v2 != 16 );
    v5 = 0;
    do
    {
    final[custom_check_final_index_table[v5]] = iv[v5] ^ final[v5];
    v5++;
    }
    while ( v5 != 16 );
    }

    char aes_final_key[16];
    custom_check_shuffle_final_key(aes_initial_key, aes_final_key);

    This final key should be able to decrypt the 16 bytes

    The first 4 decrypted bytes cast to an int will be 0xFF000000 if you're running an official rom, or 0xEE000000 if you've flashed something custom If it's 0xEE000000 then you will be shown the "Custom" boot screen with the padlock on it, and it also causes a call to mdelay(5000) before actually booting the kernel.
    I've also seen 0xCC000000 mentioned in debug prints, causing it to print the device status as "Scanning" instead of "Official" or "Custom"


    Unfortunately this doesn't seem to help much with the boot.img check, but I've found where that is and am reversing it now.


    ----------------------------------------------------------------------------------------------------------------------------------------------------------------

    DDI Data
    Here's where the values like the flash count are stored (sometimes this might be called triangle state?) It's stored at 0x3FFE00 on the mmc

    struct ddi_data {
    int magic; // must be 0x12340012
    int custom_flash_count;
    int odin_count;
    int binary_type; // 0 = samsung official, 1 = custom, 2 = "Unknown"
    char model_name[16];
    int rom_type; // this is the first 4 bytes of the decrypted 16 bytes in the param partition. 0xFF000000 = samsung, 0xEE000000 = custom }


    ----------------------------------------------------------------------------------------------------------------------------------------------------------------

    Reboot Reason

    Values and effects for the reboot reason stored at 0x2A03F65C

    0x12345671 - ?
    0x12345678 - Normal mode


    0x77665500 - FASTBOOT_MODE. displays "downloading" boot image
    0x77665501 - ? seen checked but haven't found it used anywhere
    0x77665502 - RECOVERY_MODE. sets param_header.state to 3
    0x77665503 - sets param_header.state to 4. haven't seen it actually used

    0x77665507 - display the "not authorized" picture

    if ((reason & ~0xF) == 0x77665510) then they're commands for manipulating the nvdata I wouldn't play around with these unless you really know what you're doing All of them reboot the device into the normal mode except 0x77665515

    0x77665511 - copy modemst1 to fsg partition and copy modemst2 to backup partition. sets param_header.nvdata_backup to 1
    0x77665512 - copy fsg to modemst1 and copy backup to modemst2. checks to ensure param_header.nvdata_backup=1 first
    0x77665514 - erase fsg and backup partitions. clears param_header.nvdata_backup
    0x77665515 - same as 0x77665511 but then reboots the device into RECOVERY_MODE


    0x776655EE - RAMDUMP_MODE (only valid if param_debug.debug_level is DMID/DHIG)


    0xABCD4F4C - set param_debug.debug_level to DLOW 0xABCD494D - set param_debug.debug_level to DMID
    0xABCD4948 - set param_debug.debug_level to DHIG

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------

    boot_type INCOMPLETE
    1 = fastboot
    2 = ramdump mode
    3 = recovery. resets param_debug
    4 = ?


    ----------------------------------------------------------------------------------------------------------------------------------------------------------------

    USB Flags INCOMPLETE

    0xF00 - jig mask
    0x100 - put the device into factory mode
    0x400 - change "console" boot parameter to "console=ttyHSL0,115200,n8%s" where %s is replaced by whatever was originally after "console="

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------

    ODIN

    In addition to the ODIN/LOKE handshake sequence I saw in heimdall, there are 2 more in the S3.
    Send "FPGM" and you should get a response of "OK". It functions exactly as the ODIN/LOKE sequence.
    Send "ROOTING" and it responds with the current DDI data and terminates.

    -Lee