<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.theiphonewiki.com/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Crash-x</id>
	<title>The iPhone Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.theiphonewiki.com/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Crash-x"/>
	<link rel="alternate" type="text/html" href="https://www.theiphonewiki.com/wiki/Special:Contributions/Crash-x"/>
	<updated>2026-04-09T13:38:44Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.14</generator>
	<entry>
		<id>https://www.theiphonewiki.com/w/index.php?title=Ultrasn0w&amp;diff=4090</id>
		<title>Ultrasn0w</title>
		<link rel="alternate" type="text/html" href="https://www.theiphonewiki.com/w/index.php?title=Ultrasn0w&amp;diff=4090"/>
		<updated>2009-07-05T11:48:44Z</updated>

		<summary type="html">&lt;p&gt;Crash-x: Added a log from an irc chat where planetbeing explains how the unlock and the baseband work&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;ultrasn0w (previously: '''yellowsn0w''') is the only [[iPhone 3G]] [[Unlock 2.0|unlock]] payload. yellowsn0w was released on 01/01/09 [http://blog.iphone-dev.org/post/67797811/dont-eat-yellowsn0w]. ultrasn0w was released on June 23th 2009 [http://blog.iphone-dev.org/post/128573459/ultras-now].&lt;br /&gt;
&lt;br /&gt;
==Credit==&lt;br /&gt;
MuscleNerd, and [[The dev team]]&lt;br /&gt;
&lt;br /&gt;
==Exploit==&lt;br /&gt;
Relies on an unsigned code injection vulnerability.&lt;br /&gt;
&lt;br /&gt;
The actual unlock works by a daemon patching the baseband's RAM on-the-fly, overriding the carrier lock code. It is not permanent because of the signature checks - the bootloader has to pass the sigchecks and the baseband has to pass them too, so any change to the baseband/bootloader cannot be made.&lt;br /&gt;
&lt;br /&gt;
==Current Injection Vector==&lt;br /&gt;
ultrasn0w refers to the reuseable '''payload''', but it requires an injection vector in order to be inserted into the baseband. yellowsn0w was originally to be released with an injection vector that works on pre-2.28.00 baseband versions. However, [[geohot]] had an injection vector for 2.28.00 and the decision was made to release yellowsn0w with this injection vector to benefit the most people. This injection vector is discussed [[AT+stkprof Exploit|here]]. ultrasn0w uses a different injection vector - [[AT+XLOG Exploit]].&lt;br /&gt;
&lt;br /&gt;
==ultrasn0w payload with comments (by Oranav)==&lt;br /&gt;
&lt;br /&gt;
===Code loader (incl. Stage2)===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ROM:00000000 ; =============== S U B R O U T I N E =======================================&lt;br /&gt;
ROM:00000000&lt;br /&gt;
ROM:00000000&lt;br /&gt;
ROM:00000000 code_loader&lt;br /&gt;
ROM:00000000 dest_addr = R1&lt;br /&gt;
ROM:00000000 src_addr = R6&lt;br /&gt;
ROM:00000000                 MOVLS   dest_addr, 0x110&lt;br /&gt;
ROM:00000004                 ADDS    dest_addr, #6&lt;br /&gt;
ROM:00000006                 LSLS    dest_addr, dest_addr, #8 ; unused ram to place code = 0x11600&lt;br /&gt;
ROM:00000008                 ADDS    R2, dest_addr, #1 ; thumbing&lt;br /&gt;
ROM:0000000A&lt;br /&gt;
ROM:0000000A loop                                    ; CODE XREF: code_loader+24�j&lt;br /&gt;
ROM:0000000A                 MOVLS   R0, 0x22 ; '&amp;quot;'&lt;br /&gt;
ROM:0000000E                 LDRB    R3, [src_addr]  ; first nibble&lt;br /&gt;
ROM:00000010                 CMP     R0, R3&lt;br /&gt;
ROM:00000012                 LDRB    R0, [src_addr,#1] ; second nibble&lt;br /&gt;
ROM:00000014                 BEQ     run             ; branch if end of string&lt;br /&gt;
ROM:00000016                 SUBS    R3, #0x41       ; subtract 'A'&lt;br /&gt;
ROM:00000018                 SUBS    R0, #0x41       ; subtract 'A'&lt;br /&gt;
ROM:0000001A                 LSLS    R3, R3, #4      ; make room for next nibble&lt;br /&gt;
ROM:0000001C                 ADDS    R3, R3, R0      ; put them together as a byte&lt;br /&gt;
ROM:0000001E                 STRB    R3, [dest_addr]&lt;br /&gt;
ROM:00000020                 ADDS    dest_addr, #1&lt;br /&gt;
ROM:00000022                 ADDS    src_addr, #2&lt;br /&gt;
ROM:00000024                 B       loop&lt;br /&gt;
ROM:00000026 ; ---------------------------------------------------------------------------&lt;br /&gt;
ROM:00000026&lt;br /&gt;
ROM:00000026 run                                     ; CODE XREF: code_loader+14�j&lt;br /&gt;
ROM:00000026                 BLX     R2              ; handler_replace()&lt;br /&gt;
ROM:00000028                 MOVLS   R0, 0           ; safe exit&lt;br /&gt;
ROM:0000002C                 ADDS    dest_addr, R0, #0&lt;br /&gt;
ROM:0000002E                 BLX     R4&lt;br /&gt;
ROM:00000030                 MOV     SP, R5&lt;br /&gt;
ROM:00000032                 POP     {R0-src_addr,PC}&lt;br /&gt;
ROM:00000032 ; End of function code_loader&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Handler replace===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RAM:00011600 ; =============== S U B R O U T I N E =======================================&lt;br /&gt;
RAM:00011600&lt;br /&gt;
RAM:00011600&lt;br /&gt;
RAM:00011600 handler_replace&lt;br /&gt;
RAM:00011600                 PUSH    {LR}&lt;br /&gt;
RAM:00011602                 LDR     R0, =0x40492FC0 ; (probably) where to save task_loop_jmp + task_loop&lt;br /&gt;
RAM:00011604                 ADR     R1, task_loop_jmp&lt;br /&gt;
RAM:00011606                 ADR     R2, task_loop_end&lt;br /&gt;
RAM:00011608                 SUBS    R2, R2, R1      ; size of task_loop + task_loop_jmp = 0x70&lt;br /&gt;
RAM:0001160A                 LDR     R3, =0x2040882C ; memcpy()&lt;br /&gt;
RAM:0001160C                 BLX     R3&lt;br /&gt;
RAM:0001160E                 LDR     R0, =0x40492C20 ; where to save task_creator_jmp + task_creator&lt;br /&gt;
RAM:00011610                 ADR     R1, task_creator_jmp&lt;br /&gt;
RAM:00011612                 ADR     R2, task_creator_end&lt;br /&gt;
RAM:00011614                 SUBS    R2, R2, R1      ; size of task_creator + task_creator_jmp = 0xA0&lt;br /&gt;
RAM:00011616                 LDR     R3, =0x2040882C ; memcpy()&lt;br /&gt;
RAM:00011618                 BLX     R3&lt;br /&gt;
RAM:0001161A                 LDR     R0, =0x40492C20&lt;br /&gt;
RAM:0001161C                 BLX     R0              ; task_creator_jmp()&lt;br /&gt;
RAM:0001161E                 POP     {PC}&lt;br /&gt;
RAM:0001161E ; End of function handler_replace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Task creator (thanks Darkmen for the comments!)===&lt;br /&gt;
I'm also missing here a comment.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RAM:40492C20 ; =============== S U B R O U T I N E =======================================&lt;br /&gt;
RAM:40492C20&lt;br /&gt;
RAM:40492C20&lt;br /&gt;
RAM:40492C20 task_creator_jmp&lt;br /&gt;
RAM:40492C20                 STMFD   SP!, {R1-R12,LR}&lt;br /&gt;
RAM:40492C24                 BLX     task_creator&lt;br /&gt;
RAM:40492C28                 LDMFD   SP!, {R1-R12,PC}&lt;br /&gt;
RAM:40492C28 ; End of function task_creator_jmp&lt;br /&gt;
RAM:40492C28&lt;br /&gt;
RAM:40492C2C&lt;br /&gt;
RAM:40492C2C ; =============== S U B R O U T I N E =======================================&lt;br /&gt;
RAM:40492C2C&lt;br /&gt;
RAM:40492C2C&lt;br /&gt;
RAM:40492C2C task_creator                            ; CODE XREF: task_creator_jmp+4�p&lt;br /&gt;
RAM:40492C2C                 PUSH    {R4-R7,LR}&lt;br /&gt;
RAM:40492C2E                 LDR     R3, =0x401ED3B8 ; jumptable var&lt;br /&gt;
RAM:40492C30                 MOVLS   R4, 0x800&lt;br /&gt;
RAM:40492C34                 SUB     SP, SP, #0x24&lt;br /&gt;
RAM:40492C36                 STRH    R0, [R3]        ; R0 = task_creator_jmp addr&lt;br /&gt;
RAM:40492C38                 LDR     R5, =0x201493F0 ; malloc&lt;br /&gt;
RAM:40492C3A                 ADDS    R0, R4, #0      ; 0x800&lt;br /&gt;
RAM:40492C3C                 ADDS    R7, R1, #0      ; R7 = resp_string&lt;br /&gt;
RAM:40492C3E                 BLX     R5              ; malloc(0x800)&lt;br /&gt;
RAM:40492C40                 ADDS    R6, R0, #0      ; R6 = addr returned from malloc&lt;br /&gt;
RAM:40492C42                 MOVS    R0, #0x98       ; sizeof(NU_TASK)&lt;br /&gt;
RAM:40492C44                 BLX     R5              ; malloc(sizeof(NU_TASK))&lt;br /&gt;
RAM:40492C46                 MOVS    R2, #0&lt;br /&gt;
RAM:40492C48                 MOVS    R3, #0x44&lt;br /&gt;
RAM:40492C4A                 LDR     R1, =aDevteam1  ; char *name&lt;br /&gt;
RAM:40492C4C                 STR     R2, [R0,#0xC]   ; task.field=0&lt;br /&gt;
RAM:40492C4E                 STR     R3, [SP,#0xC]   ; priority = 0x44&lt;br /&gt;
RAM:40492C50                 MOVS    R3, #0xA&lt;br /&gt;
RAM:40492C52                 STR     R3, [SP,#0x14]  ; preempt = NU_PREEMPT&lt;br /&gt;
RAM:40492C54                 MOVS    R3, #0xC&lt;br /&gt;
RAM:40492C56                 STR     R2, [SP]        ; void *argv = 0&lt;br /&gt;
RAM:40492C58                 STR     R4, [SP,#8]     ; stack_size = 0x800&lt;br /&gt;
RAM:40492C5A                 STR     R2, [SP,#0x10]  ; time_slice = 0&lt;br /&gt;
RAM:40492C5C                 STR     R3, [SP,#0x18]  ; auto_start = NU_START&lt;br /&gt;
RAM:40492C5E                 LDR     R2, =0x40492FC0 ; ???&lt;br /&gt;
RAM:40492C60                 STR     R6, [SP,#4]     ; void *stack_address = malloc(0x800)&lt;br /&gt;
RAM:40492C62                 MOVS    R3, #0&lt;br /&gt;
RAM:40492C64                 LDR     R4, =0x2043E5B4 ; NU_Create_Task&lt;br /&gt;
RAM:40492C66                 BLX     R4              ; status = NU_Create_Task()&lt;br /&gt;
RAM:40492C68                 ADDS    R2, R0, #0      ; R2 = status (for the %d reference in sprintf)&lt;br /&gt;
RAM:40492C6A                 CMP     R0, #0          ; success = zero&lt;br /&gt;
RAM:40492C6C                 BNE     status_error&lt;br /&gt;
RAM:40492C6E                 LDR     R1, =aOk        ; &amp;quot;OK!&amp;quot;&lt;br /&gt;
RAM:40492C70                 ADDS    R0, R7, #0      ; resp_string&lt;br /&gt;
RAM:40492C72                 LDR     R3, =0x204B11F0 ; sprintf&lt;br /&gt;
RAM:40492C74                 BLX     R3              ; sprintf(resp_string, &amp;quot;OK!&amp;quot;)&lt;br /&gt;
RAM:40492C76                 B       exit&lt;br /&gt;
RAM:40492C78 ; ---------------------------------------------------------------------------&lt;br /&gt;
RAM:40492C78&lt;br /&gt;
RAM:40492C78 status_error                            ; CODE XREF: task_creator+40�j&lt;br /&gt;
RAM:40492C78                 LDR     R1, =aErrorD    ; &amp;quot;ERROR %d&amp;quot;&lt;br /&gt;
RAM:40492C7A                 ADDS    R0, R7, #0      ; resp_string&lt;br /&gt;
RAM:40492C7C                 LDR     R3, =0x204B11F0 ; sprintf&lt;br /&gt;
RAM:40492C7E                 BLX     R3              ; sprintf(resp_string, &amp;quot;ERROR %d&amp;quot;, status)&lt;br /&gt;
RAM:40492C80&lt;br /&gt;
RAM:40492C80 exit                                    ; CODE XREF: task_creator+4A�j&lt;br /&gt;
RAM:40492C80                 ADD     SP, SP, #0x24   ; fixing stack&lt;br /&gt;
RAM:40492C82                 POP     {R4-R7,PC}&lt;br /&gt;
RAM:40492C82 ; End of function task_creator&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Unlock task loop (thanks Darkmen for the comments!)===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RAM:00011630 ; =============== S U B R O U T I N E =======================================&lt;br /&gt;
RAM:00011630&lt;br /&gt;
RAM:00011630&lt;br /&gt;
RAM:00011630 task_loop_jmp&lt;br /&gt;
RAM:00011630                 STMFD   SP!, {R1-R12,LR}&lt;br /&gt;
RAM:00011634                 BLX     task_loop&lt;br /&gt;
RAM:00011634 ; ---------------------------------------------------------------------------&lt;br /&gt;
RAM:00011638                 LDMFD   SP!, {R1-R12,PC}&lt;br /&gt;
RAM:00011638 ; End of function task_loop_jmp&lt;br /&gt;
RAM:00011638&lt;br /&gt;
RAM:0001163C&lt;br /&gt;
RAM:0001163C ; =============== S U B R O U T I N E =======================================&lt;br /&gt;
RAM:0001163C&lt;br /&gt;
RAM:0001163C&lt;br /&gt;
RAM:0001163C task_loop&lt;br /&gt;
RAM:0001163C                 PUSH    {R4,R5,LR}&lt;br /&gt;
RAM:0001163E                 LDR     R5, =0x401E829C ; sec mailbox&lt;br /&gt;
RAM:00011640                 SUB     SP, SP, #0x14&lt;br /&gt;
RAM:00011642&lt;br /&gt;
RAM:00011642 loop                                    ; CODE XREF: task_loop+44�j&lt;br /&gt;
RAM:00011642                 LDR     R3, =0x2042FFD8 ; NU_Receive_From_Mailbox&lt;br /&gt;
RAM:00011644                 ADDS    R0, R5, #0      ; NU_MAILBOX *mailbox&lt;br /&gt;
RAM:00011646                 MOV     R1, SP          ; void *Message&lt;br /&gt;
RAM:00011648                 MOVS    R2, #0xFF       ; Timeout&lt;br /&gt;
RAM:0001164A                 BLX     R3              ; NU_Receive_From_Mailbox(sec_mailbox,SP,0xFF)&lt;br /&gt;
RAM:0001164C                 LDR     R3, [SP]        ; Message[0]&lt;br /&gt;
RAM:0001164E                 CMP     R3, #0xD        ; Message[0] = 0xD ?&lt;br /&gt;
RAM:00011650                 BNE     skip&lt;br /&gt;
RAM:00011652                 LDR     R1, [SP,#4]     ; Message[1]&lt;br /&gt;
RAM:00011654                 LDR     R3, =0x40301650&lt;br /&gt;
RAM:00011656                 LDR     R2, [R1]        ; Message[1].field0&lt;br /&gt;
RAM:00011658                 STR     R2, [R3]        ; sec_task_var1 = Message[1].field0&lt;br /&gt;
RAM:0001165A                 ADDS    R3, #4          ; 0x40301654&lt;br /&gt;
RAM:0001165C                 LDR     R2, [R1,#4]     ; Message[1].field1&lt;br /&gt;
RAM:0001165E                 STR     R2, [R3]        ; sec_task_var2 = Message[1].field1&lt;br /&gt;
RAM:00011660                 LDR     R2, [R1,#8]     ; Message[1].field2&lt;br /&gt;
RAM:00011662                 LDR     R3, =0x100FF00&lt;br /&gt;
RAM:00011664                 STR     R3, [R2]        ; Message[1].field2[0] = 0x100FF00&lt;br /&gt;
RAM:00011666                 LDR     R3, =0x4020401&lt;br /&gt;
RAM:00011668                 STR     R3, [R2,#4]     ; Message[1].field2[1] = 0x4020401&lt;br /&gt;
RAM:0001166A                 LDR     R3, =0x4040403&lt;br /&gt;
RAM:0001166C                 STR     R3, [R2,#8]     ; Message[1].field2[2] = 0x4040403&lt;br /&gt;
RAM:0001166E                 MOVS    R3, #1&lt;br /&gt;
RAM:00011670                 STR     R3, [R1,#0xC]   ; Message[1].field3 = 1&lt;br /&gt;
RAM:00011672                 MOVS    R3, #0x20 ; ' '&lt;br /&gt;
RAM:00011674                 STR     R3, [SP] ; Message[0] = 0x20&lt;br /&gt;
RAM:00011676&lt;br /&gt;
RAM:00011676 skip                                    ; CODE XREF: task_loop+14�j&lt;br /&gt;
RAM:00011676                 ADDS    R0, R5, #0      ; sec mailbox&lt;br /&gt;
RAM:00011678                 MOV     R1, SP          ; void *Message&lt;br /&gt;
RAM:0001167A                 MOVS    R2, #0xFF       ; timeout&lt;br /&gt;
RAM:0001167C                 LDR     R3, =0x20430040&lt;br /&gt;
RAM:0001167E                 BLX     R3              ; NU_Send_To_Mailbox()&lt;br /&gt;
RAM:00011680                 B       loop&lt;br /&gt;
RAM:00011680 ; End of function task_loop&lt;br /&gt;
RAM:00011680&lt;br /&gt;
RAM:00011680 ; ---------------------------------------------------------------------------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Old yellowsn0w payload w/ comments (by Darkmen) ===&lt;br /&gt;
&lt;br /&gt;
The exploit consists from 4 parts:&lt;br /&gt;
&lt;br /&gt;
===Code loader===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ROM:00000000 ; =============== S U B R O U T I N E =======================================&lt;br /&gt;
ROM:00000000&lt;br /&gt;
ROM:00000000&lt;br /&gt;
ROM:00000000 loader&lt;br /&gt;
ROM:00000000                 LDR     R2, =0x11700    ; unused ram to place code&lt;br /&gt;
ROM:00000002                 ADDS    R4, R2, #1      ; thumb switch&lt;br /&gt;
ROM:00000004                 LDR     R3, =0x40159FBF ; at-handler buffer where stage2 binary and following hexdata are&lt;br /&gt;
ROM:00000006&lt;br /&gt;
ROM:00000006 copy.loop                               ; CODE XREF: loader+12�j&lt;br /&gt;
ROM:00000006                 LDRB    R0, [R3]        ; copying code+data until double quotes&lt;br /&gt;
ROM:00000008                 CMP     R0, #0x22 ; '&amp;quot;'&lt;br /&gt;
ROM:0000000A                 BEQ     run             ; jump thumb code&lt;br /&gt;
ROM:0000000C                 STRB    R0, [R2]&lt;br /&gt;
ROM:0000000E                 ADDS    R2, #1&lt;br /&gt;
ROM:00000010                 ADDS    R3, #1&lt;br /&gt;
ROM:00000012                 B       copy.loop       ; &lt;br /&gt;
ROM:00000014 run                                     ; CODE XREF: loader+A�j&lt;br /&gt;
ROM:00000014                 BX      R4              ; jump stage2 code&lt;br /&gt;
ROM:00000014 ; End of function loader&lt;br /&gt;
ROM:00000014&lt;br /&gt;
ROM:00000014 ; ---------------------------------------------------------------------------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Stage2(tm)===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RAM:00000000 ; =============== S U B R O U T I N E =======================================&lt;br /&gt;
RAM:00000000 stage2&lt;br /&gt;
RAM:00000000                 ADDS    R2, #0x10       ; R2 = 0x11700 + stage2 size&lt;br /&gt;
RAM:00000002                 MOVS    R7, #0xF&lt;br /&gt;
RAM:00000004                 BICS    R2, R7          ; align offset by 0x10&lt;br /&gt;
RAM:00000006                 ADDS    R7, R2, #0      ; saving address to jump&lt;br /&gt;
RAM:00000008                 ADR     R4, 0x44        ; skipping Stage2 size and taking first char from at-string&lt;br /&gt;
RAM:0000000A                 ADR     R5, char2byte   ; loading routine addr&lt;br /&gt;
RAM:0000000C                 ADDS    R5, #1          ; thumb&lt;br /&gt;
RAM:0000000E&lt;br /&gt;
RAM:0000000E loop                                    ; CODE XREF: stage2+2C�j&lt;br /&gt;
RAM:0000000E                 LDRB    R1, [R4]        ; at-string[index]&lt;br /&gt;
RAM:00000010                 CMP     R1, #'x'        ; end of line?&lt;br /&gt;
RAM:00000012                 BEQ     jump_code&lt;br /&gt;
RAM:00000014                 BLX     R5              ; char2byte first hakfbyte&lt;br /&gt;
RAM:00000016                 LSLS    R3, R1, #4      ; &amp;lt;&amp;lt;4 0X becoming X0&lt;br /&gt;
RAM:00000018                 LDRB    R1, [R4,#1]     ; at-string[index+1]&lt;br /&gt;
RAM:0000001A                 BLX     R5              ; char2hex second halfbyte&lt;br /&gt;
RAM:0000001C                 NOP&lt;br /&gt;
RAM:0000001E                 NOP&lt;br /&gt;
RAM:00000020                 NOP&lt;br /&gt;
RAM:00000022                 NOP&lt;br /&gt;
RAM:00000024                 ADDS    R1, R1, R3      ; R1 = complete byte&lt;br /&gt;
RAM:00000026                 STRB    R1, [R2]        ; storing byte to dst&lt;br /&gt;
RAM:00000028                 ADDS    R4, #2          ; hexstr_index+=2&lt;br /&gt;
RAM:0000002A                 ADDS    R2, #1          ; dst++&lt;br /&gt;
RAM:0000002C                 B       loop            ; at-string[index]&lt;br /&gt;
RAM:0000002E jump_code&lt;br /&gt;
RAM:0000002E                 NOP&lt;br /&gt;
RAM:00000030                 NOP&lt;br /&gt;
RAM:00000032                 ADDS    R7, #1          ; thumbing&lt;br /&gt;
RAM:00000034                 BX      R7              ; run Task creator code&lt;br /&gt;
RAM:00000034 ; End of function stage2&lt;br /&gt;
RAM:00000038&lt;br /&gt;
RAM:00000038 ; =============== S U B R O U T I N E =======================================&lt;br /&gt;
RAM:00000038 char2byte                               ; DATA XREF: stage2+A�o&lt;br /&gt;
RAM:00000038                 CMP     R1, #0x41 ; 'A'&lt;br /&gt;
RAM:0000003A                 BGE     letter          ; letter to number&lt;br /&gt;
RAM:0000003C                 SUBS    R1, #0x30 ; '0' ; digit to number&lt;br /&gt;
RAM:0000003E                 BX      LR&lt;br /&gt;
RAM:00000040 letter                                  ; CODE XREF: char2byte+2�j&lt;br /&gt;
RAM:00000040                 SUBS    R1, #0x37 ; '7' ; letter to number&lt;br /&gt;
RAM:00000042                 BX      LR              ; ret&lt;br /&gt;
RAM:00000042 ; End of function char2byte&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Task creator===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RAM:000119A0 ; =============== S U B R O U T I N E =======================================&lt;br /&gt;
RAM:000119A0&lt;br /&gt;
RAM:000119A0&lt;br /&gt;
RAM:000119A0 handler_replace&lt;br /&gt;
RAM:000119A0                 LDR     R0, =0x4011714C ; soft reset handler addr&lt;br /&gt;
RAM:000119A2                 ADR     R1, new_handler&lt;br /&gt;
RAM:000119A4                 ADDS    R1, #1          ; thumbing&lt;br /&gt;
RAM:000119A6                 STR     R1, [R0]        ; setting new handler&lt;br /&gt;
RAM:000119A8                 POP     {R0-R4,PC}      ; safe exit fixing stack&lt;br /&gt;
RAM:000119A8 ; End of function handler_replace&lt;br /&gt;
&lt;br /&gt;
RAM:000119B0 ; =============== S U B R O U T I N E =======================================&lt;br /&gt;
RAM:000119B0&lt;br /&gt;
RAM:000119B0&lt;br /&gt;
RAM:000119B0 new_handler                             ; DATA XREF: handler_replace+2�o&lt;br /&gt;
RAM:000119B0                 PUSH    {R4-R7,LR}&lt;br /&gt;
RAM:000119B2                 LDR     R3, =0x403BB344 ; jamptable var&lt;br /&gt;
RAM:000119B4                 MOVS    R6, #0x80&lt;br /&gt;
RAM:000119B6                 SUB     SP, SP, #0x2C&lt;br /&gt;
RAM:000119B8                 LSLS    R6, R6, #4      ; 0x200&lt;br /&gt;
RAM:000119BA                 STRH    R0, [R3]        ; saving R0 to mem var&lt;br /&gt;
RAM:000119BC                 STR     R1, [SP,#0x40+resp_string] ; saving responce prt to stack&lt;br /&gt;
RAM:000119BE                 LDR     R4, =0x201420AC ; malloc&lt;br /&gt;
RAM:000119C0                 ADDS    R0, R6, #0&lt;br /&gt;
RAM:000119C2                 BLX     R4              ; malloc(0x200)&lt;br /&gt;
RAM:000119C4                 MOVS    R5, #0&lt;br /&gt;
RAM:000119C6                 STR     R0, [SP,#0x40+ptr_200] ; saving pointer to stack&lt;br /&gt;
RAM:000119C8                 MOVS    R0, #0x98       ; sizeof(NU_TASK)&lt;br /&gt;
RAM:000119CA                 BLX     R4              ; malloc(0x98)&lt;br /&gt;
RAM:000119CC                 ADDS    R7, R0, #0      ; R7 = task&lt;br /&gt;
RAM:000119CE                 STR     R5, [R0,#0xC]   ; task.field=0&lt;br /&gt;
RAM:000119D0                 MOVS    R0, 0x100&lt;br /&gt;
RAM:000119D4                 BLX     R4              ; malloc(0x100)&lt;br /&gt;
RAM:000119D6                 MOVS    R2, #0x80&lt;br /&gt;
RAM:000119D8                 LDR     R1, =task_loop  ; src&lt;br /&gt;
RAM:000119DA                 LSLS    R2, R2, #1      ; size to copy&lt;br /&gt;
RAM:000119DC                 LDR     R3, =0x203C58A0 ; bytecpy&lt;br /&gt;
RAM:000119DE                 ADDS    R4, R0, #0      ; R4 = dyn_task_loop&lt;br /&gt;
RAM:000119E0                 BLX     R3              ; bytecpy(task_loop, dyn_task_loop, 0x100)&lt;br /&gt;
RAM:000119E2                 LDR     R3, [SP,#0x40+ptr_200]&lt;br /&gt;
RAM:000119E4                 STR     R3, [SP,#4]     ; void *stack_address = malloc(0x200)&lt;br /&gt;
RAM:000119E6                 MOVS    R3, #0x44&lt;br /&gt;
RAM:000119E8                 STR     R3, [SP,#0xC]   ; priority = 0x44&lt;br /&gt;
RAM:000119EA                 MOVS    R3, #0xA&lt;br /&gt;
RAM:000119EC                 ADDS    R4, #1          ; thumbing dyn_task_loop&lt;br /&gt;
RAM:000119EE                 STR     R3, [SP,#0x14]  ; preempt = NU_PREEMPT&lt;br /&gt;
RAM:000119F0                 MOVS    R3, #0xC&lt;br /&gt;
RAM:000119F2                 ADDS    R2, R4, #0      ; void(*task_entry)&lt;br /&gt;
RAM:000119F4                 STR     R3, [SP,#0x18]  ; auto_start = NU_START&lt;br /&gt;
RAM:000119F6                 LDR     R1, =devteam1   ; char *name&lt;br /&gt;
RAM:000119F8                 STR     R5, [SP]        ; void *argv = 0&lt;br /&gt;
RAM:000119FA                 STR     R6, [SP,#8]     ; stack_size = 0x200&lt;br /&gt;
RAM:000119FC                 STR     R5, [SP,#0x10]  ; time_slice = 0&lt;br /&gt;
RAM:000119FE                 ADDS    R0, R7, #0      ; NU_TASK *task&lt;br /&gt;
RAM:00011A00                 MOVS    R3, #0          ; int argc = 0&lt;br /&gt;
RAM:00011A02                 LDR     R4, =0x203FB540 ; NU_Create_Task&lt;br /&gt;
RAM:00011A04                 BLX     R4              ; status = NU_Create_Task()&lt;br /&gt;
RAM:00011A06                 ADDS    R2, R0, #0&lt;br /&gt;
RAM:00011A08                 CMP     R0, #0          ; success = zero&lt;br /&gt;
RAM:00011A0A                 BNE     status_error&lt;br /&gt;
RAM:00011A0C                 LDR     R1, =OK&lt;br /&gt;
RAM:00011A0E                 LDR     R0, [SP,#0x40+resp_string]&lt;br /&gt;
RAM:00011A10                 LDR     R3, =0x2046DD00 ; sprintf&lt;br /&gt;
RAM:00011A12                 BLX     R3              ; sprintf(resp_string,&amp;quot;OK&amp;quot;)&lt;br /&gt;
RAM:00011A14                 B       exit            ; fixing stack&lt;br /&gt;
RAM:00011A16 ; ---------------------------------------------------------------------------&lt;br /&gt;
RAM:00011A16&lt;br /&gt;
RAM:00011A16 status_error                            ; CODE XREF: new_handler+5A�j&lt;br /&gt;
RAM:00011A16                 LDR     R1, =ERROR&lt;br /&gt;
RAM:00011A18                 LDR     R0, [SP,#0x40+resp_string]&lt;br /&gt;
RAM:00011A1A                 LDR     R3, =0x2046DD00 ; sprintf&lt;br /&gt;
RAM:00011A1C                 BLX     R3              ; sprintf(resp_string,&amp;quot;ERROR&amp;quot;)&lt;br /&gt;
RAM:00011A1E&lt;br /&gt;
RAM:00011A1E exit                                    ; CODE XREF: new_handler+64�j&lt;br /&gt;
RAM:00011A1E                 ADD     SP, SP, #0x2C   ; fixing stack&lt;br /&gt;
RAM:00011A20                 POP     {R4-R7,PC}      ; bye&lt;br /&gt;
RAM:00011A20 ; End of function new_handler&lt;br /&gt;
RAM:00011A20&lt;br /&gt;
RAM:00011A20 ; ---------------------------------------------------------------------------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Unlock task loop===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RAM:00011A64 ; =============== S U B R O U T I N E =======================================&lt;br /&gt;
RAM:00011A64&lt;br /&gt;
RAM:00011A64 task_loop                               ; DATA XREF: RAM:off_11A2C�o&lt;br /&gt;
RAM:00011A64                 PUSH    {R4,R5,LR}&lt;br /&gt;
RAM:00011A66                 LDR     R5, =0x40232754 ; sec mailbox&lt;br /&gt;
RAM:00011A68                 SUB     SP, SP, #0x14&lt;br /&gt;
RAM:00011A6A&lt;br /&gt;
RAM:00011A6A loop                                    ; CODE XREF: task_loop+44�j&lt;br /&gt;
RAM:00011A6A                 LDR     R3, =0x20165998 ; NU_Receive_From_Mailbox&lt;br /&gt;
RAM:00011A6C                 ADDS    R0, R5, #0      ; NU_MAILBOX *mailbox&lt;br /&gt;
RAM:00011A6E                 MOV     R1, SP          ; void *Message&lt;br /&gt;
RAM:00011A70                 MOVS    R2, #0xFF       ; Timeout&lt;br /&gt;
RAM:00011A72                 BLX     R3              ; NU_Receive_From_Mailbox(sec_mailbox,SP,0xFF)&lt;br /&gt;
RAM:00011A74                 LDR     R3, [SP]        ; Message[0]&lt;br /&gt;
RAM:00011A76                 CMP     R3, #0xD        ; Message[0] = 0xD ?&lt;br /&gt;
RAM:00011A78                 BNE     skip            ; &lt;br /&gt;
RAM:00011A7A                 LDR     R1, [SP,#4]     ; Message[1]&lt;br /&gt;
RAM:00011A7C                 LDR     R3, =0x402F79BC&lt;br /&gt;
RAM:00011A7E                 LDR     R2, [R1]        ; Message[1].field0&lt;br /&gt;
RAM:00011A80                 STR     R2, [R3]        ; sec_task_var1 = Message[1].field0&lt;br /&gt;
RAM:00011A82                 ADDS    R3, #4          ; 0x402F79C0&lt;br /&gt;
RAM:00011A84                 LDR     R2, [R1,#4]     ; Message[1].field1&lt;br /&gt;
RAM:00011A86                 STR     R2, [R3]        ; sec_task_var2 = Message[1].field1&lt;br /&gt;
RAM:00011A88                 LDR     R2, [R1,#8]     ; Message[1].field2&lt;br /&gt;
RAM:00011A8A                 LDR     R3, =0x100FF00&lt;br /&gt;
RAM:00011A8C                 STR     R3, [R2]        ; Message[1].field2[0] = 0x100FF00&lt;br /&gt;
RAM:00011A8E                 LDR     R3, =0x4020401&lt;br /&gt;
RAM:00011A90                 STR     R3, [R2,#4]     ; Message[1].field2[1] = 0x4020401&lt;br /&gt;
RAM:00011A92                 LDR     R3, =0x4040403&lt;br /&gt;
RAM:00011A94                 STR     R3, [R2,#8]     ; Message[1].field2[2] = 0x4040403&lt;br /&gt;
RAM:00011A96                 MOVS    R3, #1&lt;br /&gt;
RAM:00011A98                 STR     R3, [R1,#0xC]   ; Message[1].field3 = 1&lt;br /&gt;
RAM:00011A9A                 MOVS    R3, #0x20       &lt;br /&gt;
RAM:00011A9C                 STR     R3, [SP]        ; Message[0] = 0x20&lt;br /&gt;
RAM:00011A9E&lt;br /&gt;
RAM:00011A9E skip                                    ; CODE XREF: task_loop+14�j&lt;br /&gt;
RAM:00011A9E                 ADDS    R0, R5, #0      ; sec mailbox&lt;br /&gt;
RAM:00011AA0                 MOV     R1, SP          ; void *Message&lt;br /&gt;
RAM:00011AA2                 MOVS    R2, #0xFF       ; timeout&lt;br /&gt;
RAM:00011AA4                 LDR     R3, =0x203ED568&lt;br /&gt;
RAM:00011AA6                 BLX     R3              ; NU_Send_To_Mailbox()&lt;br /&gt;
RAM:00011AA8                 B       loop            ; NU_Receive_From_Mailbox&lt;br /&gt;
RAM:00011AA8 ; End of function task_loop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Planetbeing explains...===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
13:24:29  &amp;lt;crash-x_&amp;gt; especially how does ultra/yellow sn0w work&lt;br /&gt;
13:24:40  &amp;lt;crash-x_&amp;gt; are you overwriting instructions&lt;br /&gt;
13:24:48  &amp;lt;crash-x_&amp;gt; or some values in memory to make it accept the sim?&lt;br /&gt;
13:24:48  &amp;lt;planetbeing&amp;gt; Nah.&lt;br /&gt;
13:24:53  &amp;lt;planetbeing&amp;gt; It's a task.&lt;br /&gt;
13:25:06  &amp;lt;planetbeing&amp;gt; That just waits for securiy messages to go through the inbox.&lt;br /&gt;
13:25:13  &amp;lt;westbaer&amp;gt; planetbeing: btw, why isnt yellowsn0w/ultrasn0w not open-source anymore? like u posted an *oooold* version once&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
13:26:33  &amp;lt;planetbeing&amp;gt; The only thing I do for ys/us is the loader bit.&lt;br /&gt;
13:26:39  &amp;lt;westbaer&amp;gt; so whats actually the loader stuff you've been talking about?&lt;br /&gt;
13:26:46  &amp;lt;planetbeing&amp;gt; That uses the exploit to start MuscleNerd's payload.&lt;br /&gt;
13:27:21  &amp;lt;westbaer&amp;gt; ah&lt;br /&gt;
13:27:26  &amp;lt;planetbeing&amp;gt; Well, you have a vulnerability.&lt;br /&gt;
13:27:30  &amp;lt;planetbeing&amp;gt; And you want to load a large chunk of code.&lt;br /&gt;
13:27:39  &amp;lt;planetbeing&amp;gt; And you don't have much room to wriggle in for your overflow&lt;br /&gt;
13:28:21  &amp;lt;westbaer&amp;gt; aah, makes sense&lt;br /&gt;
13:28:50  &amp;lt;planetbeing&amp;gt; So the solution is a small loader that loads the rest of the code, and overcomes any restrictions there are on allowable characters.&lt;br /&gt;
13:28:55  &amp;lt;ashikase&amp;gt; francis: pm&lt;br /&gt;
13:28:59  &amp;lt;westbaer&amp;gt; yeah&lt;br /&gt;
13:29:10  &amp;lt;crash-x_&amp;gt; planetbeing: the baseband is it like one process that runs there&lt;br /&gt;
13:29:19  &amp;lt;crash-x_&amp;gt; or is it like a small os with process and stuff&lt;br /&gt;
13:29:19  &amp;lt;planetbeing&amp;gt; Basically a good loader should turn a vulnerability into a reliable platform for the execution of arbitrary code, unrestricted by vulnerability-specific stuff.&lt;br /&gt;
13:29:37  &amp;lt;planetbeing&amp;gt; Oh, it's a full-featured OS.&lt;br /&gt;
13:29:38  &amp;lt;planetbeing&amp;gt; Nucleus.&lt;br /&gt;
13:29:51  &amp;lt;planetbeing&amp;gt; http://www.mentor.com/products/embedded_software/nucleus_rtos/&lt;br /&gt;
13:29:54  &amp;lt;crash-x_&amp;gt; and when you execute an at command&lt;br /&gt;
13:30:06  &amp;lt;crash-x_&amp;gt; does that start another process that is crashed then&lt;br /&gt;
13:30:21  &amp;lt;planetbeing&amp;gt; Ideally, you don't crash anything.&lt;br /&gt;
13:30:21  &amp;lt;crash-x_&amp;gt; or does it crash like the main baseband program&lt;br /&gt;
13:30:23  &amp;lt;planetbeing&amp;gt; And we don't.&lt;br /&gt;
13:30:49  &amp;lt;crash-x_&amp;gt; so am i understand it right&lt;br /&gt;
13:30:50  &amp;lt;westbaer&amp;gt; wait. is nucleus on the baseband already installed or do you actually inject it with ultrasn0w?&lt;br /&gt;
13:30:51  &amp;lt;planetbeing&amp;gt; We load a bunch of code into certain memory locations, execute them, and then return safely back to the main command parser task.&lt;br /&gt;
13:31:00  &amp;lt;planetbeing&amp;gt; Nucleus is what the baseband runs.&lt;br /&gt;
13:31:04  &amp;lt;westbaer&amp;gt; ah ok&lt;br /&gt;
13:31:29  &amp;lt;planetbeing&amp;gt; I mean, even the bootrom is an OS.&lt;br /&gt;
13:31:36  &amp;lt;planetbeing&amp;gt; With one task, but it still has a scheduler. =P&lt;br /&gt;
13:31:39  &amp;lt;crash-x_&amp;gt; ah thats how you do it&lt;br /&gt;
13:31:42  &amp;lt;westbaer&amp;gt; heh&lt;br /&gt;
13:31:44  &amp;lt;crash-x_&amp;gt; and about your payload&lt;br /&gt;
13:31:57  &amp;lt;crash-x_&amp;gt; does it start a new process like using fork() &lt;br /&gt;
13:32:03  &amp;lt;crash-x_&amp;gt; or does it all the work in the exploited process&lt;br /&gt;
13:32:11  &amp;lt;planetbeing&amp;gt; It uses Nucleus-specific calls that create the new task.&lt;br /&gt;
13:32:19  &amp;lt;planetbeing&amp;gt; Well, the payload has to create a new task&lt;br /&gt;
13:32:22  &amp;lt;westbaer&amp;gt; I think they are documented on the wiki&lt;br /&gt;
13:32:25  &amp;lt;planetbeing&amp;gt; To monitor for certain events.&lt;br /&gt;
13:32:47  &amp;lt;planetbeing&amp;gt; Yeah, just read Darkmen's decompile.&lt;br /&gt;
13:33:00  &amp;lt;planetbeing&amp;gt; us has the exact same payload as ys&lt;br /&gt;
13:33:08  &amp;lt;planetbeing&amp;gt; Just different addresses for function calls and stuff.&lt;br /&gt;
13:33:19  &amp;lt;planetbeing&amp;gt; And I had to rewrite the loader due to even tighter constraints.&lt;br /&gt;
13:33:28  &amp;lt;crash-x_&amp;gt; thats cool, thanks for explaining&lt;br /&gt;
13:33:34  &amp;lt;westbaer&amp;gt; yup, thanks&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From irc.saurik.com #iphone_ on sunday the 5th of july.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Source Code==&lt;br /&gt;
The source code for yellowsn0w 0.9.1 (old version) was released along with yellowsn0w release. [http://xs1.iphwn.org/releases/yellowsn0w.tar.bz2]&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
* [[X-Gold 608 Unlock]]&lt;br /&gt;
* [[X-Gold 608]]&lt;br /&gt;
* [[Baseband]]&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
* [http://chronic-dev.org/blog/2008/12/props/ Chronic Dev's post about Yellowsn0w]&lt;br /&gt;
* [http://blog.iphone-dev.org/post/65126957/tis-the-season-to-be-jolly Yellowsn0w Announcement]&lt;br /&gt;
* [http://qik.com/video/729275 MuscleNerd's yellowsn0w Demo]&lt;br /&gt;
* [http://yellowsn0w.com yellowsn0w Official Website]&lt;br /&gt;
* [http://www.youtube.com/watch?v=kd5vOy2m5uY MuscleNerd's ultrasn0w demo]&lt;br /&gt;
&lt;br /&gt;
[[Category:Unlocking Methods]]&lt;br /&gt;
[[Category:Baseband]]&lt;/div&gt;</summary>
		<author><name>Crash-x</name></author>
		
	</entry>
</feed>