Skip to content

feat(premium): cryptographic session verification for premium bypass#3019

Merged
Xephi merged 1 commit intomasterfrom
feat/premium
May 5, 2026
Merged

feat(premium): cryptographic session verification for premium bypass#3019
Xephi merged 1 commit intomasterfrom
feat/premium

Conversation

@Xephi
Copy link
Copy Markdown
Contributor

@Xephi Xephi commented May 2, 2026

Requirements

  • PacketEvents must be installed on the server, unless you
    are using proxy mode (see "Behind a proxy" on docs/premium.md).

How it works

When a premium-enrolled player connects, AuthMe intercepts the Minecraft login handshake at
the packet level:

sequenceDiagram
    autonumber
    participant C as Client
    participant S as Server (AuthMe + PacketEvents)
    participant M as Mojang

    C->>S: LOGIN_START (name)
    Note over S: ① DB: isPremium → true (async)
    S->>C: ENCRYPTION_REQUEST (RSA-1024 Key + Random Token)
    
    rect rgb(240, 240, 240)
        Note right of C: Client starts encrypting outbound traffic
        C->>M: POST /session/minecraft/join
        C->>S: ENCRYPTION_RESPONSE (enc sharedSecret + Token)
    end

    Note over S: ② RSA-decrypt sharedSecret (sync/event-loop)
    Note over S: ③ Install AES/CFB8 Netty ciphers (sync, client sends encrypted from here)
    
    S->>M: ④ Verify token + GET /hasJoined (async)
    M-->>S: {uuid, name, properties}
    
    Note over S: ⑤ Store verified UUID (60s TTL)
    Note over S: ⑥ Re-inject LOGIN_START

    S->>C: Login Success

    rect rgb(230, 245, 230)
        Note over S: AsynchronousJoin: 
        Note over S: getVerifiedUuid(name) == auth.getPremiumUuid() -> Success / Auto-Login
    end
Loading

Copy link
Copy Markdown
Member

@TuxCoding TuxCoding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope you don't mind my many comments :D

Comment thread authme-bungee/src/main/java/fr/xephi/authme/bungee/BungeeProxyBridge.java Outdated
Comment thread README.md Outdated
Comment thread authme-core/src/main/resources/messages/messages_en.yml Outdated
Comment thread authme-velocity/src/main/java/fr/xephi/authme/velocity/VelocityProxyBridge.java Outdated
Comment thread docs/premium.md Outdated
Comment thread authme-core/src/main/resources/messages/messages_ro.yml Outdated
Copy link
Copy Markdown
Member

@TuxCoding TuxCoding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I performed a CodeRabbit review in TuxCoding#14 and it found some noteworthy things. I copied the relevant things here.

Comment thread authme-core/src/main/java/fr/xephi/authme/service/bungeecord/BungeeReceiver.java Outdated
Comment thread authme-core/src/main/java/fr/xephi/authme/service/bungeecord/BungeeSender.java Outdated
Comment thread authme-core/src/main/java/fr/xephi/authme/service/PremiumLoginVerifier.java Outdated
Comment thread docs/premium.md Outdated
@Xephi Xephi marked this pull request as ready for review May 3, 2026 20:37
@Xephi Xephi requested a review from TuxCoding May 3, 2026 20:43
Copy link
Copy Markdown
Member

@TuxCoding TuxCoding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did the translation files broke? :D

The pending verification looks good so far.

Comment thread authme-core/src/main/resources/messages/messages_de.yml Outdated
Comment thread authme-core/src/main/java/fr/xephi/authme/service/bungeecord/BungeeReceiver.java Outdated
Comment thread authme-core/src/main/java/fr/xephi/authme/service/bungeecord/BungeeSender.java Outdated
@lokspel
Copy link
Copy Markdown

lokspel commented May 4, 2026

if you are doing /premium then rejoin and login it says you're already logged in
image

@lokspel
Copy link
Copy Markdown

lokspel commented May 4, 2026

and what will happens if the license name will be changed, account will be locked?

@Xephi
Copy link
Copy Markdown
Contributor Author

Xephi commented May 4, 2026

if you are doing /premium then rejoin and login it says you're already logged in image

Should be fixed with ec5038a

and what will happens if the license name will be changed, account will be locked?

During the /premium process, you're kicked, you have to re-login to enable the premium feature completely. If you change your account name later, you'll may have to /login & /freemium + /premium again, but you won't be locked

@lokspel
Copy link
Copy Markdown

lokspel commented May 4, 2026

everything works
kick_reason: '&cНастройки Premium вашего аккаунта были изменены администратором. Пожалуйста, переподключитесь.'
but the kick reason for premium is not translated if the client is in russia

@lokspel
Copy link
Copy Markdown

lokspel commented May 4, 2026

we still use sessions even tho we dont need if we already use premium mode

@Xephi
Copy link
Copy Markdown
Contributor Author

Xephi commented May 4, 2026

everything works kick_reason: '&cНастройки Premium вашего аккаунта были изменены администратором. Пожалуйста, переподключитесь.' but the kick reason for premium is not translated if the client is in russia

1b9f647

we still use sessions even tho we dont need if we already use premium mode

188c752

wah, can't write a good commit message anymore, time to sleep

@lokspel
Copy link
Copy Markdown

lokspel commented May 5, 2026

Why we store only online uuid in the db?
I think we should store offline as well in case if someone migrated from another plugin like https://github.com/whereareiam/Identica or nlogin with custom generated uuids

@lokspel
Copy link
Copy Markdown

lokspel commented May 5, 2026

Everything works now feel free to merge

…bypass

- fix(messages): restore UTF-8 encoding in de/br/et translation files
- fix(premium): avoid removing fresh cache entry on expiry check
- fix(premium): use Bukkit async scheduler and refresh proxy carrier player
- fix(premium): cache updating workflow was broken
- fix(premium): Re-order session handling, so premium user don't consume session uselessly
- fix(premium): Correctly select translated the kick message
- feat(proxy): send premium ids list in chunk for large lists
@Xephi Xephi merged commit 8c04fa7 into master May 5, 2026
5 checks passed
@Xephi Xephi deleted the feat/premium branch May 5, 2026 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants