Search Unity

How secure is my game source code

Discussion in 'General Discussion' started by billgs, Apr 28, 2019.

  1. billgs

    billgs

    Joined:
    Mar 1, 2016
    Posts:
    4
    Hello, I made my first game and I have publish it to android ! I am thinking to also publish it to iOS and Facebook games or html5,
    My question is how secure is my code in each of this platforms
    1. How easy is for someone to read my source code
    2. Is it possible to do something that they are not supposed to, like pressing a disabled/not interactable button
    3. Can they change an array int value

    Thanks
     
    Last edited: Apr 28, 2019
  2. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,161
    Incredibly, unless you use an incredibly robust obfuscator, but even that just makes the job annoying rather than impossible.

    Yes, but this doesn't even require source code access.
     
    Ony likes this.
  3. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Any software that is exposed to a user can have its source code decompiled.
     
    joshcamas likes this.
  4. billgs

    billgs

    Joined:
    Mar 1, 2016
    Posts:
    4
    So they can find my secret api keys from source code ?
    Is there any way to protect from changing private string and prevent them from pressing where they shouldn't (disabled buttons)
     
  5. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,161
    Do not store your API keys in your source code.
     
    Ony likes this.
  6. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    No code that you execute on the client computer can always be tampered with
    Some say Unity is less secure than let's say UE since it's MSIL and easy to decomopile.

    But relaying on that is called security by obscurity and it's naive and dumb
     
  7. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,203
    Code can always be analyzed. It may not be in the original form but that just means the person has to reverse engineer the machine code (or bytecode in the case of C# and Java) making up the program. Obfuscation only slows down the hackers with the least experience.

    Both of these are completely possible. If you need data to be secure you need to store it on a server. Any data stored in a client is best treated as data that is compromised.
     
  8. SparrowGS

    SparrowGS

    Joined:
    Apr 6, 2017
    Posts:
    2,536
    Only way to do it is with remote play, where the game runs on your machine (your server) and the player sends the keyboard input to the server and he gets the video output to his machine.

    Like @Ryiah said, anything thats on a user machine can be hacked.
     
  9. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    Every api service that uses keys has documentation bolded or yelling at you in some way not to store them on the client, and how to handle it securely. So you ignored that or didn't bother to read the docs.

    Strings are the simplest thing to get at, there is even a program called strings that literally comes with every version of linux and mac and from a free MS published tool on windows. So ya someone can take educated guesses at what services you use, or just peak at the network traffic via something like fiddler, then grab your keys as they are usually very easy to identify, and go destroy all of your data or alter it or do any number of bad things.
     
  10. bobisgod234

    bobisgod234

    Joined:
    Nov 15, 2016
    Posts:
    1,042
    Try disassembling your own game yourself. It's very easy to do, and it's the best way to see first hand how easy your source code will be to access.
     
  11. If you don't want people to read your code, do not give your application to people. Develop server, or very limited streaming application.
     
  12. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,982
    1. easy
    2. yes
    3. yes
     
  13. billgs

    billgs

    Joined:
    Mar 1, 2016
    Posts:
    4
    Ok actually I put my api code in the plugin asset field (I assume this is the correct way) but what about my admob ids or if I want to add a send email function most tutorial need emaik password in script
     
  14. Dabeh

    Dabeh

    Joined:
    Oct 26, 2011
    Posts:
    1,614
    You use a server.

    Assume anything on the client can be read and changed by anyone.
     
  15. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Using a Mono backend build makes getting your C# source code trivial. IL2CPP means they won't be getting back your original C# code with a single tool, but they can easily get assembly code or possibly C++. With a lot of work it is possible to get back the C# code, but unlikely anyone would put in the effort unless a tool has been created I'm unaware of.
     
    MadeFromPolygons likes this.