Homebrew RAM editing glitch on any 3DS, might lead to an exploit?

Trinitro21

Well-Known Member
OP
Member
Joined
Oct 14, 2015
Messages
133
Trophies
0
Location
Userland
XP
206
Country
United States
TL;DR there's an oversight in SmileBASIC that leads to RAM viewing and editing on any 3DS, hacked or unhacked. It could lead to a primary exploit, but it probably won't. I don't know for sure though, so I'm posting it here to see what comes of it.

In the SmileBASIC interpreter, there's a bug with the BGSCREEN command, which resizes the background layer. The area of the background layer isn't supposed to exceed 16383, but the checks the interpreter performs on the parameters are insufficient and can be bypassed with large enough numbers.

The game will crash if the area is too large; however, there's a window where the game doesn't crash and the BG layer occupies sizes never meant to be possible. Because of this, it contains memory allocated for other purposes by the interpreter, like variable and function storage and the current program's code.

With the BG commands, this area of memory can be edited by any 3DS, hacked or unhacked.

All that is needed to trigger this glitch is this one line of code:
Code:
BGSCREEN 0,134217728,16

Could a primary exploit be made with this bug?

It is an area of RAM allocated for the interpreter, so it's probably not executable and so likely not exploitable. However I know that there are pointers in the memory that can be edited, as well as many unknown segments of memory. Perhaps a variable's pointer could be edited to use executable memory or some other attack could be developed that could lead to an exploit?

EDIT: I'm stupid and forgot to give credit.
This glitch was found by a group of users at smilebasicsource.com, including slackerSnail, 12Me21, and incvoid.
I was somewhat part of it.
 
Last edited by Trinitro21,

proflayton123

The Temp Loaf'
Member
Joined
Jan 11, 2016
Messages
6,032
Trophies
1
Age
24
Location
日本
Website
www.facebook.com
XP
3,212
Country
Japan
TL;DR there's an oversight in SmileBASIC that leads to RAM viewing and editing on any 3DS, hacked or unhacked. It could lead to a primary exploit, but it probably won't. I don't know for sure though, so I'm posting it here to see what comes of it.

In the SmileBASIC interpreter, there's a bug with the BGSCREEN command, which resizes the background layer. The area of the background layer isn't supposed to exceed 16383, but the checks the interpreter performs on the parameters are insufficient and can be bypassed with large enough numbers.

The game will crash if the area is too large; however, there's a window where the game doesn't crash and the BG layer occupies sizes never meant to be possible. Because of this, it contains memory allocated for other purposes by the interpreter, like variable and function storage and the current program's code.

With the BG commands, this area of memory can be edited by any 3DS, hacked or unhacked.

All that is needed to trigger this glitch is this one line of code:
Code:
BGSCREEN 0,134217728,16

Could a primary exploit be made with this bug?

It is an area of RAM allocated for the interpreter, so it's probably not executable and so likely not exploitable. However I know that there are pointers in the memory that can be edited, as well as many unknown segments of memory. Perhaps a variable's pointer could be edited to use executable memory or some other attack could be developed that could lead to an exploit?

Finally, a thread with a theory of possible hax with good explanation with it
 

seijinshu

...
Member
Joined
Jan 6, 2016
Messages
483
Trophies
0
Location
...
XP
248
Country
United States
TL;DR there's an oversight in SmileBASIC that leads to RAM viewing and editing on any 3DS, hacked or unhacked. It could lead to a primary exploit, but it probably won't. I don't know for sure though, so I'm posting it here to see what comes of it.

In the SmileBASIC interpreter, there's a bug with the BGSCREEN command, which resizes the background layer. The area of the background layer isn't supposed to exceed 16383, but the checks the interpreter performs on the parameters are insufficient and can be bypassed with large enough numbers.

The game will crash if the area is too large; however, there's a window where the game doesn't crash and the BG layer occupies sizes never meant to be possible. Because of this, it contains memory allocated for other purposes by the interpreter, like variable and function storage and the current program's code.

With the BG commands, this area of memory can be edited by any 3DS, hacked or unhacked.

All that is needed to trigger this glitch is this one line of code:
Code:
BGSCREEN 0,134217728,16

Could a primary exploit be made with this bug?

It is an area of RAM allocated for the interpreter, so it's probably not executable and so likely not exploitable. However I know that there are pointers in the memory that can be edited, as well as many unknown segments of memory. Perhaps a variable's pointer could be edited to use executable memory or some other attack could be developed that could lead to an exploit?

Excellent. I think one of these games would be better for hacking than my theory with FE:Fates.
 

PF2M

Ex-Miiverse Hacker
Member
Joined
Sep 8, 2015
Messages
552
Trophies
0
Age
23
Location
Ohio
XP
1,000
Country
United States
Just tested the crashing version of it and it worked. Reminds me of that one line of Petit Computer code that crashed the game. My question is, how can the line of code you provided be used to edit the RAM? Is there other commands you can type in to do so?
 

Trinitro21

Well-Known Member
OP
Member
Joined
Oct 14, 2015
Messages
133
Trophies
0
Location
Userland
XP
206
Country
United States
Just tested the crashing version of it and it worked. Reminds me of that one line of Petit Computer code that crashed the game. My question is, how can the line of code you provided be used to edit the RAM? Is there other commands you can type in to do so?
BGGET can be used to get the two bytes at each tile and BGPUT can be used to write a new value.
RAM editors have already been made, but aren't on the SmileBASIC servers for secrecy. One can be downloaded here and injected into your extdata to be used.
 

Trinitro21

Well-Known Member
OP
Member
Joined
Oct 14, 2015
Messages
133
Trophies
0
Location
Userland
XP
206
Country
United States
You mentioned ram viewing was possible, how is that done?
The glitch makes the background layer data extend into the rest of the RAM, so simply triggering it and offsetting the background layer is enough to view the RAM. The data can also be retrieved with the BGGET command.
 

seijinshu

...
Member
Joined
Jan 6, 2016
Messages
483
Trophies
0
Location
...
XP
248
Country
United States
The glitch makes the background layer data extend into the rest of the RAM, so simply triggering it and offsetting the background layer is enough to view the RAM. The data can also be retrieved with the BGGET command.
Hmm. This would actually work with more investigating. Getting the ability to edit RAM would be such an excellent approach. If I successfully get my exploit working, we might be able to do a dual release kinda similar to IronHax/TubeHax.
 

proflayton123

The Temp Loaf'
Member
Joined
Jan 11, 2016
Messages
6,032
Trophies
1
Age
24
Location
日本
Website
www.facebook.com
XP
3,212
Country
Japan
Hmm. This would actually work with more investigating. Getting the ability to edit RAM would be such an excellent approach. If I successfully get my exploit working, we might be able to do a dual release kinda similar to IronHax/TubeHax.

.-.


Sent from my iPhone using Tapatalk
 
  • Like
Reactions: Deleted User

Damon_girl

Well-Known Member
Member
Joined
Oct 27, 2015
Messages
961
Trophies
0
Age
31
XP
553
Country
United States
Can this RAM editing be used for games too? Like on SSB or Hyrule Warriors Legends to make it play better on the old 3DS?
 

KaduPSE

Revolution and cake
Member
Joined
Dec 26, 2015
Messages
260
Trophies
0
XP
408
Country
Brazil
Can this RAM editing be used for games too? Like on SSB or Hyrule Warriors Legends to make it play better on the old 3DS?
RAM editing means changing the code/values stored on RAM. The goal would be to replace them with exploitable code. It's not related to performance at all. RAM editing could be used to cheat on games, but since in this case the RAM is filled with data for this title it wouldn't be possible.
 

Mrrraou

Well-Known Member
Member
Joined
Oct 17, 2015
Messages
1,873
Trophies
0
XP
2,374
Country
France
not possible because of memory mapping: you can sure read executable memory but not write into it
you need a rop or a way to be even able to use gspwn
 
  • Like
Reactions: Ricken

Clector

Well-Known Member
Member
Joined
Mar 15, 2016
Messages
1,078
Trophies
0
Location
Not here
XP
459
Country
Bangladesh
Well I was going to buy it, but because some things I wanted to buy before I will buy a eShop card this Thursday, but if there"s going to be an exploit it will be better to know so then I will buy it before since we know what Nintendo uses to do whit 3rd Party exploitable games.
 
Last edited by Clector,

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • HiradeGirl @ HiradeGirl:
    Too bad, they already drank it.
  • HiradeGirl @ HiradeGirl:
    He is now fishy.
  • K3Nv2 @ K3Nv2:
    Sak is a fishy pineapple
  • HiradeGirl @ HiradeGirl:
    Have a good night everyone.
  • HiradeGirl @ HiradeGirl:
    i'm getting sleepy.
  • HiradeGirl @ HiradeGirl:
    So much drinking from @K3Nv2
  • HiradeGirl @ HiradeGirl:
    Have a nice day. Life. Week. Month. year.
  • K3Nv2 @ K3Nv2:
    10 tabs open on chrome and no slow downs suck it low ram plebs lol
  • Veho @ Veho:
    Firefox users be like "look at what they have to do to mimic a fraction of our power."
  • K3Nv2 @ K3Nv2:
    they be like which lite firefox exe pls
  • Veho @ Veho:
    Wut.
  • Maximumbeans @ Maximumbeans:
    GM all
  • K3Nv2 @ K3Nv2:
    butt
  • SylverReZ @ SylverReZ:
    douche
  • Veho @ Veho:
    Touché.
  • SylverReZ @ SylverReZ:
    Push it :creep:
  • Veho @ Veho:
    Talk about propaganda.
  • Veho @ Veho:
    Illinois is working to ban toxic food additives that have been banned for decades in other countries; additives that can be replaced and all those countries still have Skittles and Mountain Dew. Title of the piece: GUBMINT WANTS TO TAKE AWAY YOUR CANDY
  • Veho @ Veho:
    Gee, I wonder if the author is biased?
  • SylverReZ @ SylverReZ:
    @Veho, Sounds and smells like bullshit. They don't give you cancer, and California should know that. I don't get why they stick labels that say "may or may not cause reproductive harm or cancer".
  • Veho @ Veho:
    Arsenic doesn't give you cancer either.
    Veho @ Veho: Arsenic doesn't give you cancer either.