कंटेंट पर जाएँ
HackIndex logo

HackIndex

टूल्स

Laravel कुकी फोर्ज और डीकोडर

Laravel AES एन्क्रिप्टेड कुकीज़ डीकोड करें या हस्ताक्षरित फोर्ज करें — CTF और अधिकृत परीक्षण के लिए।

Laravel सभी cookies को AES-256-CBC (या Laravel 10+ पर AES-256-GCM) से आपकी .env फ़ाइल के APP_KEY का उपयोग करके एन्क्रिप्ट करता है। एन्क्रिप्टेड मान base64-एन्कोडेड JSON है जिसमें IV, ciphertext और HMAC-SHA256 सिग्नेचर होता है। यह टूल cookie को डिक्रिप्ट करके सेशन payload — user ID, role, CSRF token — दिखाता है, HMAC सिग्नेचर सत्यापित करता है और नई वैध हस्ताक्षरित cookie forge करने देता है। सभी प्रोसेसिंग सर्वर-साइड PHP में होती है। कुछ भी स्टोर या लॉग नहीं किया जाता।

कुकी डीकोड करें

मौजूदा कुकी डिक्रिप्ट और सत्यापित करें

स्वीकार करता है: base64:xxx (मानक), hex स्ट्रिंग, या कच्चा base64। लक्ष्य .env में APP_KEY के रूप में मिलता है।

कुकी फोर्ज करें

वैध हस्ताक्षरित Laravel कुकी बनाएं

AES-256-CBC Laravel 9 और नीचे के लिए डिफ़ॉल्ट है। AES-256-GCM Laravel 10+ के लिए।

Tip: decode a real cookie first to see the exact serialized format, then modify and forge.

यह कैसे काम करता है

Laravel encrypts cookies using AES-256-CBC (or AES-128-CBC / GCM variants) with the APP_KEY from your .env file. The encrypted value is base64-encoded JSON containing an IV, the ciphertext, and an HMAC-SHA256 signature. This tool decrypts and verifies the signature or forges a new valid cookie from scratch. Both operations happen server-side in PHP without storing any input.

  1. 1. Get the cookie: intercept the target request in Burp Suite or browser DevTools and copy the laravel_session cookie value.
  2. 2. Get the APP_KEY: find it in the target .env, a leaked config, or crack it from known plaintext.
  3. 3. Decode: paste both above and decode to reveal the session payload (user ID, CSRF token, flash data).
  4. 4. Modify & forge: change the payload (e.g. elevate user_id), paste the APP_KEY and forge a new valid signed cookie.
  5. 5. Inject: replace the original cookie in your request and resend.

Laravel एन्क्रिप्टेड कुकीज़ क्या हैं?

Laravel automatically encrypts and signs all cookies set via Cookie::make() or the cookie helper (unless excluded via $except in EncryptCookies middleware). The session cookie (laravel_session by default) uses the cookie session driver only when SESSION_DRIVER=cookie, otherwise it contains just an encrypted session ID pointer. In CTF challenges, apps frequently use the cookie driver to store the full session payload directly in the cookie.

iv

Initialisation Vector. Randomly generated for each encryption operation. Base64-encoded inside the JSON payload.

value

The AES-encrypted ciphertext. Base64-encoded. openssl_encrypt() with flags=0 (default) returns base64 directly.

mac

HMAC-SHA256 of base64(iv) concatenated with base64(value), keyed with the raw APP_KEY bytes. Absent for GCM ciphers.

tag

GCM authentication tag. Used instead of HMAC for AES-256-GCM and AES-128-GCM ciphers (Laravel 10+).

FAQ

क्या यह मेरी कुकी या APP_KEY कहीं भेजता है?

नहीं। डिक्रिप्शन और एन्क्रिप्शन दोनों सर्वर-साइड PHP में openssl_decrypt / openssl_encrypt का उपयोग करके होते हैं। कोई डेटा संग्रहीत, लॉग या तृतीय पक्षों को प्रेषित नहीं किया जाता।

कुकी सेशन ड्राइवर क्या है?

When SESSION_DRIVER=cookie is set in .env, Laravel serializes the entire session array, encrypts it, and stores it directly in the browser cookie. This is common in CTF challenge setups. Most production apps use file, database, or Redis drivers where only an encrypted session ID is stored in the cookie.

HMAC सिग्नेचर कैसे काम करता है?

Laravel computes hash_hmac("sha256", base64(iv) . base64(ciphertext), raw_key). Both the IV and ciphertext strings used in the MAC computation are the base64-encoded versions stored in the JSON, not the raw bytes.

फोर्जिंग के समय कौन सा सिफर चुनें?

Match the cipher to the one used by the target app. Laravel 5-9 default is AES-256-CBC. Laravel 10+ supports AES-256-GCM. You can detect it from the presence of the tag field in the decoded cookie structure (GCM has a non-empty tag field; CBC has mac instead).

सही APP_KEY के साथ भी डिक्रिप्शन विफल होता है — क्यों?

सुनिश्चित करें कि आप कच्चा कुकी मान पेस्ट कर रहे हैं, URL-एन्कोडेड संस्करण नहीं। कुछ फ्रेमवर्क कुकीज़ को दोहरा एनकोड करते हैं। कुंजी फ़ॉर्मेट भी सत्यापित करें: Laravel इसे .env में base64:xxx के रूप में संग्रहीत करता है — इसे ठीक वैसे ही पेस्ट करें।