Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gate Address are invertible #95

Open
somanayr opened this issue Jun 7, 2019 · 21 comments
Open

Gate Address are invertible #95

somanayr opened this issue Jun 7, 2019 · 21 comments

Comments

@somanayr
Copy link

somanayr commented Jun 7, 2019

Gate addresses are invertible and predictable. It looks like this is done for performance reasons, but it's also a security issue, since a player who knows your gate address can discover your location, even if you have an iris.

I put together a webapp to showcase the issue here: https://sgcraft-scanner-web.herokuapp.com/

A fix would be to encrypt the addresses with the world seed as the secret key. If you'd like, I'm happy to submit a PR for this.

@somanayr
Copy link
Author

I've looked into this a little more. Format-preserving encryption, with a key derived from the world seed, appears to be the way to go. Of course, that assumes the world seed is secret.

Let me know if you want me to put this together.

@Nex4rius
Copy link

But this is exactly canon. In the series they could use the gate address to calculate the position of the planet/stargate .

@Dockter
Copy link
Member

Dockter commented Sep 3, 2019

Having an iris prevents the security issue though so how is this an issue?

@somanayr
Copy link
Author

somanayr commented Sep 3, 2019 via email

@Dockter
Copy link
Member

Dockter commented Sep 3, 2019

Hm. Valid points. I would review PR to your suggestion of encoding it.

@Sarous
Copy link

Sarous commented Sep 4, 2019

I have personally written programs using computercraft to map all gate locations. While it is THEORETICALLY possible, it is impractical. At a dialing rate of one address per 30 seconds, it would take YEARS to map even a fraction of the addresses.

edit: Maths, there are 525,600 minutes in a year. At 2 addresses per minute, you can test 1,051,200 per year. There are a 3 quadrillion chunks (3,515,625,000,000) in a standard 30 million x 30 million block world. It would take 3,344,392 years to map every chunk at a dialing rate of 2 addresses per minute.

@somanayr
Copy link
Author

somanayr commented Sep 5, 2019 via email

@Nex4rius
Copy link

Nex4rius commented Sep 5, 2019

lol You don't need to dial to find out if a gate exists at an address.
You can check about 1 address per second with the energyToDial() function

@Sarous
Copy link

Sarous commented Sep 5, 2019

thats still a hundred thousand years.. (111,479)

@somanayr
Copy link
Author

somanayr commented Sep 5, 2019 via email

@Sarous
Copy link

Sarous commented Sep 5, 2019

Overworld is 30,000,000^2, not 20,000^2. Thus throwing off your figures.

@Dockter
Copy link
Member

Dockter commented Sep 5, 2019

Thus hurting your case more not less.

@somanayr
Copy link
Author

somanayr commented Sep 5, 2019 via email

@Sarous
Copy link

Sarous commented Sep 5, 2019

I confess I went at my math incorrectly on one point. Instead of counting chunks, I should have counted addressable gates, which is 38^7 for intra-dimensional gates, or 38^9 for all gates. There are two primary ways to design such a dialing program.

Incremental dialing would lead to having to test the entire system, regardless of world size, necessitating all intradimentional gate addresses (114,415,582,592 addresses; 3,628 years of dailling at 1/second).

Selective dialing would require you to produce a list, via some method like the above app, which would lead to a dialing program in excess of 16mb. Last I knew, ComputerCraft has a maximum program size of 2mb, though there is no technical limit on the number of separate programs it can store.

Needless to say, this is an extreme amount of effort to put into a project to locate a single needle in a very large haystack. If it ever became a mainstream problem, it would also be easy to overcome by simply dismantling a gate when not in use, and using proxy-bases.

@Dockter
Copy link
Member

Dockter commented Sep 5, 2019

So get started now is what you're saying...

@Nex4rius
Copy link

Nex4rius commented Sep 5, 2019

Or you make it easier and just code the address logic into your minecraft computer and it just converts the coords to addresses which means you don't have to store 16mb.

@somanayr
Copy link
Author

somanayr commented Sep 5, 2019 via email

@LemADEC
Copy link

LemADEC commented Jun 7, 2020

It's actually a concern since you don't need to dial to know if a gate is at the location, you just need to check for energy cost. Since there's no cooldown on such check, you scan excessively fast and can kill the server along the way.

@GHXX
Copy link

GHXX commented Jul 7, 2020

Something to add, and connect to this (even though this is a pretty old issue-thread), stargates actually only function within x= -2239472 to +2239472, and same for z, which is limiting for sure.
What i suggest is generating addresses on the fly. When a new gate is placed, the address is randomly generated and put into a cache, optionally along with the position of the stargate base, to allow for easier looking up of addresses.
Not only would this make it impossible to link addresses to coordinates via math, it also allows more than one stargate per chunk if anyone wants that, and it allows people to place stargates where ever they want, even if its at x:20 million and z:20 million.
Not sure what to do about the Dimension-digits, i guess they could also be randomly assigned as soon as the first gate is placed in that dimension.

@LemADEC
Copy link

LemADEC commented Jul 8, 2020

The base game starts glitching around 220k away from 0, as such the 2239472 range is way higher than actually needed and shouldn't be a concern.

@GHXX
Copy link

GHXX commented Jul 8, 2020

I have not been experiencing any issues playing about 2.2 million blocks away from 0,0 for both x and z, so 3 million blocks away from 0,0 in total.
Additionally, this limit removal is just an added benefit ontop of solving the problem of the addresses being reversible. Effectively solving two issues in one go; i dont see whats wrong with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants