Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
3
Question by morgaza · Mar 15, 2012 at 09:15 AM · networksecuritypreventclientsnetwork.destroy

Prevent players from using Network.Destroy()

Hi,

I currently have a problem with Unity's network system. I have a band of colleagues who test my networkgame for me to find any bugs. Recently they decompiled the game, and found themselves able to recompile it again with their new code in it.

Now normally this wouldnt give any problems as my game is working with authoritive server, but they can also call upon Network.Instantiate and Network.Destroy.

I Guess I can prevent Network.Instantiate, by checking wether the object was made by the server or not, and banning the networkView.viewID, but I can't do anything against Network.Destroy.

For example, I have a GameObject in the scene which manages the server (Slots, chat and such). Therefor, it uses a networkView to allow RPC messages. Once you decompile it and add Network.Destroy in a OnConnectedToServer() function, that corrupted client will crash the entire game for all players once he connects to the server because he destroys the server GameObject for everyone.

Are there any methods of preventing this abuse?

Many thanks in advance.

Edit: Additionally, I just found out that they can also add RPC calls themselves. Can anyone shed some light on how to make sure that clients ony accept RPC calls send by the server? I tried to ensure that the NetworkMessageInfo.sender was equal to Network.connections[0], but that didnt work out.

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image syclamoth · Mar 15, 2012 at 09:16 AM 0
Share

Well, you can try embedding some kind of checksum into the program, to ensure that it was compiled and built by you. Not sure how to do that, though- I'm not exactly a security expert!

3 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by MrGuy1212 · Oct 15, 2014 at 09:31 PM

I know this is extremely old but this is the top result on google for this question.

I have as short write up of how this may be prevented posted on reddit Here.

A quick copy and paste.

HOW TO PREVENT

Set the networkView that conducts your server/client handshaking to a particular group using: networkView.group = group#;

As soons as a client connects block incoming messages using: Network.SetReceivingEnabled(justConnectedPlayer, group#, false);

Have the server Network.Instantiate() a GameObject with a new NetworkView, assign this NetworkView a unique group number.

Send this group number to the client, remember you can still send messages to the client, they just cannot send messages to you.

This will be the group channel that the client is allowed to send messages to the server with. All other NetworkViews will set their scope to ignore this channel.

The client will still be able to call Network.Destroy() but the only thing they should effectively be able to destroy (since everything is ignoring its messages) is the channel it uses to communicate with the server. This would effectively terminate the connection with the client giving no possibility for manipulation.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image softrare · Jan 24, 2015 at 10:28 AM 0
Share

Hi! Very interesting. I am trying to accomplish what you appearently did, but I can still Network.Destroy from every client on every other networkView. Do you have like a working example at the moment?

avatar image
0

Answer by dehan · Mar 15, 2012 at 11:49 AM

Hello,

Just use a obfuscator, they make it hard to decompile the game (I think thats what it's called...)

Thanks

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by morgaza · Mar 18, 2012 at 04:21 PM

I don't think that would make much difference. For every method of obfuscation, theres a method of de-obfuscation.

I managed to rewrite all my RPC calls in a way that they cannot be abused anymore for hacking, that was just a case of using my own common sense.

I cannot make any changes to the Network.* functions though, so clients can still call Network.Destroy(gameObject); in a OnConnectedToServer() function.

I am thinking of a few possibilities that I might have missed, and I wonder if any of them are possible:

  1. Have I missed some Network.Boolean that disallows clients to call Network.Destroy() and such? I have read the Script Reference on this subject through and through, and couldnt find anything.

  2. Is there a method to filter Network Messages that are send before they are applied on the server?

  3. Is there perhaps a C# way of Overriding the Network.Destroy function, so I can check wether Network.isServer is true before destroying anything?

Or any other way that would yield same result?

A awnser on this problem would be most exhilarating!

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Regarding Network Instantiate & Destroy 1 Answer

Authenticating a user to a server using a UserId stored in PlayerPrefs 1 Answer

You may not be connected when initializing security layer. 1 Answer

Hacking Unity3d Games 1 Answer

How can I delete or destroy an instance of an object IN A MULTIPLAYER GAME?. 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges