1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved Get the IP address / hostname entered on join

Discussion in 'Development' started by jarne, Mar 17, 2020.

  1. jarne

    jarne Spider

    Messages:
    7
    GitHub:
    jarne
    Hi all,

    Is there a PocketMine API function or a package MCPE sends to the server to get the IP address / hostname the player used to connect to the server?
     
  2. QuiverlyRivalry

    QuiverlyRivalry Zombie Pigman

    Messages:
    491
    GitHub:
    quiverlyrivalry
    Cant you see that in CONSOLE? Unless you want a plugin that logs the IP?
     
  3. jarne

    jarne Spider

    Messages:
    7
    GitHub:
    jarne
    Nah, it's about to get the hostname / IP of the server the player connected to, so the address the player entered into the address field of his MCPE client.

    Like, server1.example.com pointing to 123.123.123.123
    and server2.example.com pointing to my server 123.123.123.123

    And I'm trying to get this hostname, not sure if this is even possible with MCPE packets.
     
  4. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    GamakCZ and jarne like this.
  5. jarne

    jarne Spider

    Messages:
    7
    GitHub:
    jarne
    Great, thanks, must have overlooked this! ;)
     
    HimbeersaftLP likes this.
  6. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    Glad I could help :)
     
  7. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    Be aware that players can send arbitrary addresses. Even without modding, everyone who has control to an arbitrary DNS can create an arbitrary hostname that points to your IP. Beware security issues if you rely on its format.
     
    jarne likes this.
  8. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    An example attack:
    Plugin idea is to use domain name to check which server player wants to join.
    Since the player typed the IP in their client, if they wanted to join area51.myserver.com, they know that they are joining area51 of my server, and so I can hold them responsible for joining (e.g. transfer all their area50 money into area51 money, so they lose all area50 money).
    But actually player just joined area51.pmmp.io and got directed to your server. Your plugin only checks the first part of the domain, and unexpectedly transferred away all the player's area50 money.

    Another example attack:
    So you trust the addresses you see. If the player IP says survival server, you expect them to be joining the survival server, but you are actually using the same plugin over multiple servers and you are actually on a pvp server. Now your plugin has wrong assumptions and this bug could be exploited.
     
    jarne likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.