Omnimaga

Omnimaga => News => Topic started by: DJ Omnimaga on March 29, 2011, 02:40:39 am

Title: Bypassing TI-Nspire RSA signatures now possible?
Post by: DJ Omnimaga on March 29, 2011, 02:40:39 am
As reported in French by TI-BANK (http://ti.bank.free.fr/index.php?mod=news&ac=commentaires&id=1023), it seems that bsl might have managed to bypass the RSA protection on the TI-Nspire in some ways. He has released a program called DiagsLauncher, that allows you to launch any Diagnostic software images (stored in a .tns file) on your TI-Nspire, ignoring any protection against executing such image on the calculator:



Normally, the TI-Nspire includes a diagnostic software that can be accessed by holding Esc+Menu+G (ClickPad) or Esc+Menu+Moins (TouchPad) on boot. However, it is possible that your calculator doesn't include this software or that you might have previously deleted it. Also, some might have an older version that doesn't include as many options, such as ones for the Touchpad keypad.

Unfortunately, TI didn't make it possible to re-install this software on your calculator or even update it. If you deleted it, it's gone forever. With DiagsLauncher, this problem is solved. Although this software might not be useful for the average calculator user, these images contains interesting test features that can be useful for developers and could possibly allow them to accomplish even more things on the calculator in the future. Not only that, but since this software completely ignores the RSA signature of the model (TI-Nspire, TI-Nspire CAS or even prototypes) to launch diagnostic images of any commercial models or prototypes, could this mean such method could be applied to the boot1, boot2 or even the OS?

DiagsLauncher is available in TI-BANK archives (http://ti.bank.free.fr/index.php?mod=archives&ac=voir&id=2886).
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: critor on March 29, 2011, 05:23:59 am
Great news! :)
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: Munchor on March 29, 2011, 07:44:56 am
This looks sweet, so we can access that menu, which I never heard of, in other times rather than when booting :)
It also seems like we're closer from getting the RSA algorithm :)
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: critor on March 29, 2011, 07:53:21 am
To be more precise, DiagsLauncher just runs any diagnostic image. It's completly independant from the diagnostic present in the NAND ROM, which is neither used nor altered.

You'll need at least a diagnostic image in order to use it.

You can find a dumper in another topic, but for Ndless 1.0/1.1.

You can find the most complete list of diagnostic images here:
http://tibank.forumactif.com/t6212-table-versions-nspire


Feel free to report any unlisted diags version.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: jnesselr on March 29, 2011, 07:53:22 am
This looks sweet, so we can access that menu, which I never heard of, in other times rather than when booting :)
It also seems like we're closer from getting the RSA algorithm :)
What RSA algorithm? Are you talking about solving the RSA problem? If so, I know of no algorithm to solve it.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: critor on March 29, 2011, 07:54:01 am
We're not solving: we're bypassing :P
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: Munchor on March 29, 2011, 07:55:10 am
This looks sweet, so we can access that menu, which I never heard of, in other times rather than when booting :)
It also seems like we're closer from getting the RSA algorithm :)
What RSA algorithm? Are you talking about solving the RSA problem? If so, I know of no algorithm to solve it.

I mean whatever lets you make 3rd party OSs, which I think is the RSA key, right?
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: compu on March 29, 2011, 01:35:19 pm
Nice work. Couldn't this code be used to make a simple program loader?
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: DJ Omnimaga on March 29, 2011, 02:01:33 pm
Now if only we could use this method to launch an OS image... maybe we could have some sort of Linux for the TI-Nspire, even if not executed directly on boot like the regular OS?
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: mikehill2003 on March 29, 2011, 02:58:26 pm
Can you use this to launch an OS image with an invalid signature? (Or just an OS image?)
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: DJ Omnimaga on March 29, 2011, 02:59:27 pm
I'M not sure yet, but as the news says, maybe the same method could be used to do so.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: critor on March 29, 2011, 03:02:13 pm
It's probably what the (never released) RunOS was using.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: mikehill2003 on March 29, 2011, 03:04:24 pm
It's probably what the (never released) RunOS was using.

I just got my nspire today (YAY!), do you think it would be safe to test loading an OS this way?
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: critor on March 29, 2011, 03:09:54 pm
In the worst case, you'll just have to reinstall an OS.


In fact, from my point of view we would need a similar boot2launcher program.
You could then launch a modified boot2 image, in order to launch an OS without checking the RSA signature.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: Goplat on March 29, 2011, 03:49:08 pm
I'm not sure I see the point in running OSes this way.

It could be nice to be able to run significantly different versions, like have 2.x installed for Ndless but run 3.0 for the additional math features (e.g. 3d graphing), but this doesn't work too well because you get mixed-up text that basically makes everything incomprehensible (see below for an example - 2.1 running on a 2.0.1 installation).

If you want to run your own code, just make it its own Ndless program. No reason to make extra work for yourself by putting it in .tno format.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: compu on March 29, 2011, 03:53:38 pm
And how do you run 2.1 on 2.0.1?  O.O
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: Goplat on March 29, 2011, 03:55:47 pm
And how do you run 2.1 on 2.0.1?  O.O
Same way I do all these hacks - modified nspire_emu.

Edit: You could theoretically do this on calc by using Home-Enter-X and sending the OS over RS232; it runs the received OS without installing it (since this has an 8MB limit, you would have to TNOC the OS)
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: apcalc on March 29, 2011, 03:57:53 pm
Nice pics Goplat!  I remember I got OS 1.1 running on OS 2.0 (both non-CAS) by replacing the image present on the calc.  The results were the same - the text was all messed up!
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: DJ Omnimaga on March 29, 2011, 04:00:06 pm
Nice. I wish somehow it was possible to just launch an Ndless program that overwrites the entire OS content and bypass the protections...
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: critor on March 29, 2011, 04:01:01 pm
Goplat, I think the "idea" is to launch a basic OS from an Ndlessed CAS OS.
Assuming we could launch the basic 1.7 OS over an Ndlessed CAS 1.7 OS, would we still have some strings problems? (the OS versions are the same... they should be very similar...)

And how do you run 2.1 on 2.0.1?  O.O

But using the Home+Enter+X combo and sending the 2.1 OS as a test image in RS232.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: Goplat on March 29, 2011, 04:02:15 pm
Nice. I wish somehow it was possible to just launch an Ndless program that overwrites the entire OS content and bypass the protections...
Overwriting the OS in memory is easy. What do you mean by "bypass the protections"?
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: DJ Omnimaga on March 29, 2011, 04:03:09 pm
I mean RSA signatures and the like. I do not know how that stuff works, but I assume the calc checks if the OS signature is valid upon booting, right?
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: critor on March 29, 2011, 04:03:54 pm
Nice. I wish somehow it was possible to just launch an Ndless program that overwrites the entire OS content and bypass the protections...

You can overwrite and might be able to run it by the same time...

But you'll have problems during the next reboot.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: DJ Omnimaga on March 29, 2011, 04:06:12 pm
Hmm I see... x.x
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: apcalc on March 29, 2011, 04:07:01 pm
Using the same principles as 1337mod, it should be fairly simple to replace the language/text files.  It just might be a bit of annoying work, but I think it would be doable.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: critor on March 29, 2011, 04:08:54 pm
Overwriting is not a good idea, untill we can flash modified boot1/boot2.

But launching an OS without installing it, assuming it is "similar enough" with the installed OS might be the way.
That's why my example was launching the 1.7 basic OS from an Ndlessed 1.7 CAS OS.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: DJ Omnimaga on March 29, 2011, 04:18:01 pm
Yeah true. I guess in that case Goplat might be right about third party OSes: it might just be best to make them as regular ASM/C programs.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: mikehill2003 on March 29, 2011, 04:48:49 pm
Trying to load an nspire CAS image on a regular nspire just locked it up(both were OS 2.1). Does it work the other way around?
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: critor on March 29, 2011, 04:56:08 pm
Trying to load an nspire CAS image on a regular nspire just locked it up(both were OS 2.1). Does it work the other way around?

It depends upon the way you're trying to load the OS.
If you're using the original boot2, of course it's checking the model type and won't load a CAS OS on a basic Nspire.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: mikehill2003 on March 29, 2011, 04:58:02 pm
Trying to load an nspire CAS image on a regular nspire just locked it up(both were OS 2.1). Does it work the other way around?

It depends upon the way you're trying to load the OS.
If you're using the original boot2, of course it's checking the model type and won't load a CAS OS on a basic Nspire.

Hmm. That figures. I'm too new to this to know how to modify the boot2 on my image right now. Any suggestions on where to start?

Edit: And before anyone asks, no it's not for cheating. A non-cas nspire was all I could find. I don't really need the cas os, I just don't like having the calculator not be as powerful as it can be.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: ExtendeD on March 29, 2011, 05:05:37 pm
It could be nice to be able to run significantly different versions, like have 2.x installed for Ndless but run 3.0 for the additional math features (e.g. 3d graphing), but this doesn't work too well because you get mixed-up text that basically makes everything incomprehensible (see below for an example - 2.1 running on a 2.0.1 installation).

What about patching the filesystem functions of the OS loaded to "chroot" (http://en.wikipedia.org/wiki/Chroot) the OS?

Anyway RunOS was not released to avoid giving TI good reasons (such as being able to run the CAS OS on a non-CAS TI-Nspire) for enabling the downgrade protection. This is really something none of us want.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: mikehill2003 on March 29, 2011, 05:32:45 pm
It could be nice to be able to run significantly different versions, like have 2.x installed for Ndless but run 3.0 for the additional math features (e.g. 3d graphing), but this doesn't work too well because you get mixed-up text that basically makes everything incomprehensible (see below for an example - 2.1 running on a 2.0.1 installation).

What about patching the filesystem functions of the OS loaded to "chroot" (http://en.wikipedia.org/wiki/Chroot) the OS?

Anyway RunOS was not released to avoid giving TI good reasons (such as being able to run the CAS OS on a non-CAS TI-Nspire) for enabling the downgrade protection. This is really something none of us want.

Is there any large difference between RunOS and diagslauncher? Also, my calc also locks up trying to load the same os that the calc is running. (now 2.0.1, non-cas)

Do I need to stop taking the script kiddie approach and compile it myself with modified offsets?
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: critor on March 29, 2011, 06:02:14 pm
Anyway RunOS was not released to avoid giving TI good reasons (such as being able to run the CAS OS on a non-CAS TI-Nspire) for enabling the downgrade protection.

Which they did anyway, starting from OS 2.0.0 on TouchPad models, and from OS 2.1.0 on all models...
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: mikehill2003 on March 29, 2011, 06:03:34 pm
Anyway RunOS was not released to avoid giving TI good reasons (such as being able to run the CAS OS on a non-CAS TI-Nspire) for enabling the downgrade protection.

Which they did anyway, starting from OS 2.0.0 on TouchPad models, and from OS 2.1.0 on all models...

So is there any chance of RunOS ever being released?
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: critor on March 29, 2011, 06:55:13 pm
Just released!
Non, not RunOS yet...
But the very similar Boot2Launcher program by Bsl!

You can launch any uncompressed boot2 image:
- a different image (newer or older) from the one flashed in your NAND ROM
- a prototype image on a production TI-Nspire
- a production image an a prototype TI-Nspire
- ...

Useless, you think?...
But the boot2 does care with everything related to launching (or not launching) the OS.
Guess what could be done by launching a slightly modified boot2 image...

Guess what's next...



Read/watch more (in french):
http://ti.bank.free.fr/index.php?mod=news&ac=commentaires&id=1026
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: mikehill2003 on March 29, 2011, 07:22:52 pm
Nice! So could boot2 be modified to load a modified os instead of the already-installed one?
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: critor on March 29, 2011, 08:22:51 pm
Yes, if we use a modified boot2 which could load any OS, it could also load a modified OS.

Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: Goplat on March 29, 2011, 08:26:05 pm
If you want to modify the OS, it would be far easier and quicker to just do it in-memory.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: mikehill2003 on March 29, 2011, 08:33:14 pm
If you want to modify the OS, it would be far easier and quicker to just do it in-memory.

Could I make the regular os on my nspire be the cas one this way?
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: bsl on March 29, 2011, 08:40:23 pm
Be careful with boot2launcher .
If you launch a developer boot2 on a production OS (or vice versa)it will delete that OS.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: critor on March 29, 2011, 08:42:58 pm
Be careful with boot2launcher .
If you launch a developer boot2 on a production OS (or vice versa)it will delete that OS.

Which is normal as the production and developer keys are different. (but shouldn't be a problem, as the developer boot2 images haven't been shared publicly)

By the way, thank you for you great work Bsl. :)


Maybe with a modified boot2, we could also run production OSes on Ndlessed basic & CAS TI-Nspire prototypes.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: coolrudski on March 29, 2011, 08:50:28 pm
ok maybe im missing something but what exactly could this mean for the nspire? i mean besides diagnostic wise on programs and the os (which is nice) programming capability wise what does this mean?
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: willrandship on March 29, 2011, 10:59:26 pm
It means that RunOS (CAS on reg, 84+ emu on CAS) is theoretically possible now. It also means that, if you have room, you could launch a 3rd party OS from the regular OS.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: Goplat on March 29, 2011, 11:17:37 pm
It also means that, if you have room, you could launch a 3rd party OS from the regular OS.
But why would you want to have to go through this process:

TI's OS → Ndless → boot2launcher → modified boot2 → your OS (as a .tno file)

when you could just go through this one:

TI's OS → Ndless → your OS (as an Ndless program)
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: compu on March 30, 2011, 02:02:30 pm
Maybe with a modified boot2, we could also run production OSes on Ndlessed basic & CAS TI-Nspire prototypes.
But isn't RunOS launching the OS files directly? without boot2? I think that way would be easier..
Anyway, would it be really possible to launch a CAS OS on a non-CAS calc using this way?

It also means that, if you have room, you could launch a 3rd party OS from the regular OS.
But why would you want to have to go through this process:

TI's OS → Ndless → boot2launcher → modified boot2 → your OS (as a .tno file)

when you could just go through this one:

TI's OS → Ndless → your OS (as an Ndless program)
I agree. Using ndless directly is much easier.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: critor on March 30, 2011, 02:05:14 pm
According to the video that was posted, RunOS was launching the OS directly.

But, you'd have to get a decrypted OS image first, which is not easy at all for the end user.
So it might be usefull to use a modified boot2 in order to launch the OS from a simple tnc/tno file.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: Lionel Debroux on March 30, 2011, 02:20:12 pm
Quote
But, you had to get a decrypted OS image first, which is not easy at all for the end user.
A Ndless program running on the calculator could perform the Blowfish decryption of the .tnc/.tno downloaded from TI or other sources :)

Spoiler For Spoiler:
Part of the necessary information was available in several posts by Goplat in http://www.unitedti.org/forum/index.php?showtopic=8191 , but he redacted these posts. However, both the boot2 (and the OS) contain Blowfish encryption and decryption routines, and these routines are undoubtedly called from a small number of places. IOW, the Blowfish key wouldn't be hard to find in the boot2.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: mikehill2003 on March 30, 2011, 04:04:11 pm
Why are the boot2 images so large in this video?
http://ti.bank.free.fr/index.php?mod=news&ac=commentaires&id=1026

It looks like they are ~300kb more than what TNOC removes from a standard tno/tnc.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: critor on March 30, 2011, 04:17:28 pm
Why are the boot2 images so large in this video?
http://ti.bank.free.fr/index.php?mod=news&ac=commentaires&id=1026

It looks like they are ~300kb more than what TNOC removes from a standard tno/tnc.

Like RunOS, Boot2Launcher is using uncompressed boot2 images.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: mikehill2003 on March 30, 2011, 04:19:09 pm
How are they uncompressed? Nevermind.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: FloppusMaximus on March 30, 2011, 10:53:34 pm
I believe it's actually encrypted using Wolbhsif ;)
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: Lionel Debroux on March 31, 2011, 12:38:19 pm
The boot2 is compressed in a weird format (documented on UTI), and the OS is encrypted with Blowfish.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: compu on April 04, 2011, 03:29:08 pm
I have decrypted the OS now using a method described on yAronet and modified boot2launcher's source (instead of 0x1180000 0x10000000 + size changed) but it seems that this method would be too easy. The emulator reboots with
Code: [Select]
data abort exception, lr=101f9ddc
So, is anybody gonna help me or does nobody want to talk about this because they don't want to upset TI?
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: DJ Omnimaga on April 04, 2011, 03:46:53 pm
Well make sure to not post any copyrighted stuff like code, that's for sure. I unfortunately do not know about that stuff, though, so whatever you would post, I wouldn't even know what is it. X.x. At least avoid describing completely how to perform things like running a CAS OS on Nspires it isn't supposed to run on, though, so TI won't get mad.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: compu on April 04, 2011, 03:51:26 pm
Well make sure to not post any copyrighted stuff like code, that's for sure. I unfortunately do not know about that stuff, though, so whatever you would post, I wouldn't even know what is it. X.x. At least avoid describing completely how to perform things like running a CAS OS on Nspires it isn't supposed to run on, though, so TI won't get mad.
Of course I won't post copyrighted material and I can't describe how to run the CAS because I don't know how to do this.
If you want to, I can redact my post :-X
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: critor on April 04, 2011, 04:01:44 pm
I have decrypted the OS now using a method described on yAronet and modified boot2launcher's source (instead of 0x1180000 0x10000000 + size changed) but it seems that this method would be too easy. The emulator reboots with
Code: [Select]
data abort exception, lr=101f9ddc
So, is anybody gonna help me or does nobody want to talk about this because they don't want to upset TI?

I have the code to make a "hot reboot". It's tested and working.
The OS decrypted code has to be copied some way at 0x10000000.

But you have to make sure no OS code is used at that time.
So I suppose you can neither fread directly at 0x100000000, nor use memcpy().
I've tried to use standard C functions (malloc, fread, and then a for loop and pointers...), but in the end it didn't work either.
I've disabled interrupts, same thing...
I've disabled the compiler optimisations, same thing...

I'm either getting errors speaking of:
- code allready in use
- misaligned data
either a freeze or full reboot.

I suppose, some part of the old OS code is still in use...
Maybe performing the copy operation in assembly would be a way.

It's probably quite simple, for someone who understands ARM assembly.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: compu on April 05, 2011, 08:25:52 am
So this has to be done in asm?
I have never used it. :(
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: critor on April 05, 2011, 08:39:59 am
So this has to be done in asm?
I have never used it. :(

Anyway, the "hot reboot" code is allready in asm.
So adding the "OS copy code" just before it wouldn't be a problem for me.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: compu on April 05, 2011, 08:49:51 am
What do you mean by hot reboot code?
This one line of assembly in boot2-/diagslauncher that loads the OS base address into r15/pc?
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: critor on April 05, 2011, 09:23:55 am
What do you mean by hot reboot code?
This one line of assembly in boot2-/diagslauncher that loads the OS base address into r15/pc?

For the OS, it's a little more complicated than that.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: mikehill2003 on April 05, 2011, 11:18:17 am
So would the asm code for fread from boot2 help you?
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: critor on April 05, 2011, 11:41:46 am
So would the asm code for fread from boot2 help you?

If you are referring to Boot2Launcher, it's not made in ASM but in C, except for 1 asm line which does launch the loaded boot2.

If you have an ASM version of fread, feel free to share it.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: calc84maniac on April 05, 2011, 01:38:52 pm
If someone could manage to write some fopen/fread/fwrite for the TI-Nspire's proprietary filesystem, that would certainly be a huge help to any sort of Linux port.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: mikehill2003 on April 05, 2011, 01:41:30 pm
If someone could manage to write some fopen/fread/fwrite for the TI-Nspire's proprietary filesystem, that would certainly be a huge help to any sort of Linux port.

I'm not sure what you mean by this.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: calc84maniac on April 05, 2011, 01:48:08 pm
If someone could manage to write some fopen/fread/fwrite for the TI-Nspire's proprietary filesystem, that would certainly be a huge help to any sort of Linux port.

I'm not sure what you mean by this.

TI didn't use a standard filesystem like FAT, instead they used a proprietary filesystem called Datalight Reliance. This basically means we have to rely on TI's OS code to do file access (making ports of other OS's, such as Linux, somewhat difficult)
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: Netham45 on April 05, 2011, 02:03:49 pm
Out of curiosity, has anyone taken a look at the filesystem formats yet?
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: mikehill2003 on April 05, 2011, 02:21:56 pm
Out of curiosity, has anyone taken a look at the filesystem formats yet?
Not yet, but it's on my list.


TI didn't use a standard filesystem like FAT, instead they used a proprietary filesystem called Datalight Reliance. This basically means we have to rely on TI's OS code to do file access (making ports of other OS's, such as Linux, somewhat difficult)

I see. Thanks for clearing that up, I guess I'll add that to my list of things that need to be done.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: Jim Bauwens on April 05, 2011, 03:06:50 pm
TI didn't use a standard filesystem like FAT, instead they used a proprietary filesystem called Datalight Reliance. This basically means we have to rely on TI's OS code to do file access (making ports of other OS's, such as Linux, somewhat difficult)

The best thing would be to have an image with the linux rootfs, and just point the kernel to the raw location of the file on the nand. This way you would not need to know how the filesystem works.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: Goplat on April 05, 2011, 03:42:25 pm
Out of curiosity, has anyone taken a look at the filesystem formats yet?
I looked into it a little bit a while back.

The first thing you need to know is that there are two layers involved. FlashFX Pro does bad block management and wear leveling, essentially presenting a "hard-disk" abstraction to the code above it. (You can repeatedly tell FlashFX Pro to write to the same page, but it will actually cycle through many different pages, to avoid wearing out the flash with repeated erase/program cycles; it remembers which logical page corresponds to which physical page so you will always get the right data back on a read.) On top of FlashFX Pro is Reliance, the actual filesystem.

FlashFX Pro divides the physical space into 937 "units" of 64 pages (0x8000 bytes) each, and the logical space into 59 "regions" of 976 pages (0x7A000 bytes) each. Each unit has a header page (I don't know the exact meaning of all these fields; the names are from some code in the command shell)

Bytes 00-0F: signature (CC DD "DL_FS4.00" FF FF FF FF FF)
Bytes 10-13: "clientAddress" (logical address of which region this unit is holding data for; always a multiple of 0x7A000)
Bytes 14-17: "eraseCount"
Bytes 18-1B: "lnuTag"
Bytes 1C-1F: "ulSequenceNumber"
Bytes 20-23: "serialNumber"
Bytes 24-27: "lnuTotal"
Bytes 28-2B: "numSpareUnits"
Bytes 2C-2D: "blockSize"
Bytes 2E-2F: "lnuPerRegion"
Bytes 30-31: "partitionStartUnit"
Bytes 32-33: "unitTotalBlocks"
Bytes 34-35: "unitClientBlocks"
Bytes 36-37: "unitDataBlocks"
Bytes 38-39: "checksum"

The extra 16 bytes that the flash chip has for every page are also used to hold information:
Bytes 0-1: tells which logical page this is within the region; ranges from 0x4000 to 0x43CF. (All unit header pages have this field set to 0x48E2.) Sometimes the same page of the same region will appear multiple times in different units; I don't know yet how to tell which one is the latest version of the page.
Byte 2: ones-complement of byte 0 XOR byte 1
Byte 3: error-correcting Hamming code of bytes 0-2
Bytes 4-7: seems to always be FF FF FF 0F for used pages, FF FF FF FF for unused
Bytes 8-B: error-correcting code of second half of page data
Bytes C-F: error-correcting code of first half of page data

Reliance seems to be a fairly conventional filesystem, in terms of data layout. Here's the inode structure, used to describe a file or directory:
Bytes 00-03: "INOD"
Bytes 04-07: inode number
Bytes 08-0B: size of data
Bytes 10-17: some kind of timestamp (in microseconds since 1970)
Bytes 18-1F: some kind of timestamp (in microseconds since 1970)
Bytes 20-27: some kind of timestamp (in microseconds since 1970)
Bytes 28-2B: flags
Bytes 2C-3F: always zero?
Bytes 40+: data - format depends on low bits of flags:
  If 0: contains data directly (can be up to 448 bytes)
  If 1: contains pointers to data pages (up to 56 kB)
  If 2: contains pointers to "INDI" (indirect) pages containing pointers to data pages (up to 6272 kB)
  If 3: contains pointers to "DBLI" (double indirect) pages containing pointers to "INDI" pages (up to 686 MB)

You find an inode by looking it up in inode 1's data (inode 1 is a table of inode pointers). Not sure how you find inode 1, though :p

Edit:
The best thing would be to have an image with the linux rootfs, and just point the kernel to the raw location of the file on the nand. This way you would not need to know how the filesystem works.
The problem with this is the filesystem won't keep your image file contiguous.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: Jim Bauwens on April 05, 2011, 03:51:59 pm
Ouch, that isn't so nice :(

But the first thing would be to get Linux running (with a ramdisk), and then we could look at these problems.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: shrear on April 05, 2011, 03:56:01 pm
Sorry if this a stupid question. But couldn't we just reformat a section of the flash memory(or whatever the correct term is)?
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: Goplat on April 05, 2011, 04:09:01 pm
Sorry if this a stupid question. But couldn't we just reformat a section of the flash memory(or whatever the correct term is)?
The vast majority of the flash memory is used by the filesystem. If you reformat part of that, you'll screw up the filesystem, and boot2 will just reformat it back.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: shrear on April 05, 2011, 04:10:10 pm
Oh Ok. would be to easy I suppose...
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: Goplat on April 05, 2011, 04:15:22 pm
I suppose in theory if you could replace the flash chip with a larger one, then you could use the space beyond the filesystem (current boot2's and OSes have hard-coded the filesystem area to end at 32MB, although this may change when OS 3.0 comes out because the CX will have a 128MB flash chip). I don't think there are many of us who could do that, though :p
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: mikehill2003 on April 05, 2011, 07:44:53 pm
I suppose in theory if you could replace the flash chip with a larger one, then you could use the space beyond the filesystem (current boot2's and OSes have hard-coded the filesystem area to end at 32MB, although this may change when OS 3.0 comes out because the CX will have a 128MB flash chip). I don't think there are many of us who could do that, though :p

On the CAS+ nspires replacing the NAND wouldn't be too hard, but for the production nspires you would need some expensive equipment.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: willrandship on April 05, 2011, 07:55:57 pm
Except for that tiny soldering, even on the CAS+ I'd call that hard :P
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: Lionel Debroux on April 07, 2011, 01:56:34 am
Wild ideas, probably unworkable (though nobody has yet explained why to me):
* fiddling with the boot2's load_os_image and subroutines, in such a way as to make the boot2 load a TNS file containing the raw TNO/TNC for the same or the other calculator model. For example, proceeding forward no matter what the result of checks performed by some subroutines is. However, judging by the RunOS video, that's not what it did - but it looks like that in order to replicate RunOS perfectly, the tricks would have to be independently rediscovered...
* using launch_os_image after loading the OS image at 10000000 (in such a way as not to trigger the errors mentioned by critor - perhaps by using the boot2 stdio/POSIX file functions ?).
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: mikehill2003 on April 07, 2011, 12:23:47 pm
Quote
Wild ideas, probably unworkable (though nobody has yet explained why to me):
* fiddling with the boot2's load_os_image and subroutines, in such a way as to make the boot2 load a TNS file containing the raw TNO/TNC for the same or the other calculator model. For example, proceeding forward no matter what the result of checks performed by some subroutines is. However, judging by the RunOS video, that's not what it did - but it looks like that in order to replicate RunOS perfectly, the tricks would have to be independently rediscovered...
Does this subroutine load a TNO/C into RAM without installing it?  O.O

Quote
* using launch_os_image after loading the OS image at 10000000 (in such a way as not to trigger the errors mentioned by critor
I haven't gotten this far yet.

Quote
- perhaps by using the boot2 stdio/POSIX file functions ?).
I was also thinking about this, I'm not sure if you could call the function in C though.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: Lionel Debroux on April 07, 2011, 01:41:10 pm
Calling the boot2 functions is merely a matter of making the appropriate cast to a function pointer type: ((returntype(*)(type1, type2, ..., typen))function_address)(arg1, arg2, ..., argn); :)
Or so it should be.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: Lionel Debroux on April 09, 2011, 09:10:40 am
Several notes:
* since direct fread to the destination area is impossible, it's necessary to fread to somewhere else, and somehow copy later;
* during the copy to the destination area, no access to the destination other than the ones performed by the copy code, shall occur;
* during the early bootup of the new OS, one source of perturbation (which reads from memory) shall be disabled.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: critor on April 09, 2011, 09:24:30 am
:P
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: Lionel Debroux on April 09, 2011, 09:26:47 am
:P
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: critor on April 09, 2011, 09:34:05 am
http://www.vimeo.com/21776371 :P
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: bsl on April 09, 2011, 11:35:04 am
http://www.vimeo.com/21776371 :P
Now add another intermediate step - patch Ndless hooks into it before launching :)
May be able to port Ndless2.0 to Ndless3.0 this way ?
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: critor on April 09, 2011, 12:23:02 pm
Except that launching the 3.0 OS on a 2.x installation will probably result in many display bugs.
System strings for example have different indexes and will be all messed up...

We can only launch and use a "similar" OS this way.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: DJ Omnimaga on April 12, 2011, 12:16:14 am
Will OS 3.0 and 2.x even fit on one calc at once, anyway (or at least give enough memory to the user to be functional enough and allow him to install some games)? O.O
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: Lionel Debroux on April 12, 2011, 12:19:02 am
Compression is required for not hampering the usability of the calculator for large games, as you guessed, but it can be done :)
OS 3.0 is more optimized than OS 2.1 is, as shown by critor's measurements. And that's a pretty good thing - at least (and at last), TI seems to optimize their code.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: DJ Omnimaga on April 12, 2011, 01:10:56 am
Ok. Yeah I saw the smaller size for OS 3.0. At least on that point TI was good, finally. It got smaller even if it still includes a 84+ emu and adds 3D graphing. I wish they didn't lock Ndless out, though...
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: Munchor on April 13, 2011, 07:49:06 am
The RSA Algorithm is now *impossible* to discover, 2048 bits!!!!!!!!!!!!!!!
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: Lionel Debroux on April 13, 2011, 07:54:53 am
Indeed, it's so far beyond the state of the art. TF could yield something, but with hopelessly remote chances of success.
However, don't forget that we do have arbitrary code execution on OS 1.1 to 2.1, which enables launching other OS without installing them ("RunOS") :)
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: Munchor on April 13, 2011, 07:56:08 am
Indeed, it's so far beyond the state of the art. TF could yield something, but with hopelessly remote chances of success.
However, don't forget that we do have arbitrary code execution on OS 1.1 to 2.1, which enables launching other OS without installing them ("RunOS") :)

2048 bits :( Someone said, I totally have to second, "Bypassing it has gone from impossible to impossible".
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: Jim Bauwens on April 13, 2011, 11:00:34 am
Correct me if I'm wrong, but I think that the size of the RSA signature doesn't make that you can't bypass it...
Bypassing the RSA signature makes that you don't need the RSA signature to run code.

(I hope I'm not making a fool from myself)
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: BrownyTCat on April 13, 2011, 11:04:47 am
Algorithms? Ack, I hate how protective TI is- whilst they barely make any use of the ARM processor we spent $100 on.
Title: Re: Bypassing TI-Nspire RSA signatures now possible?
Post by: mikehill2003 on April 13, 2011, 12:40:17 pm
Correct me if I'm wrong, but I think that the size of the RSA signature doesn't make that you can't bypass it...
Bypassing the RSA signature makes that you don't need the RSA signature to run code.

(I hope I'm not making a fool from myself)
Completely correct. It's not any less possible for us to crack 2048-bit then it is for us to crack 1024-bit RSA. It's more likely to rain frogs then it is for us to factor even the 1024-bit RSA keys. That's the beauty of RunOS/OSLauncher, it bypasses RSA completely.(well, except for installing and then rebooting)