← Back to Writeups
HTBN/AWeb

Cookies

XESXOR8/23/20263 min read
#web#htb#n/a

Cookies

Platform: HackerLab | Category: Web | Type: Challenge | Difficulty: Easy | OS: NA | Author: D3v0o0Nu11 | Date: 2025-12-20 | Status: Solved Techniques: Comma-separated value formatting, HTTP Cookie header manipulation, Request parameter ordering

Summary

Task: Web page requires specific cookies with amounts. Solution: Send comma-separated values in Cookie header matching the required format.

Recon

Port scan

nmap -p- -sV -sC <TARGET> --min-rate 1000 -Pn
PortServiceVersionNotes
<PORT><SVC><VER><notes>

Enumeration highlights

  • Event: hackerlab | ID: 20251220_hackerlab_cookies
  • Tags: http_cookies, cookie_manipulation, comma_separated_values, request_formatting, web_basics
  • Indicators: Page shows required cookies and their values, Hint "in one pack" suggests combining values, Multiple cookies with different amounts
  • Source: 20251220_hackerlab_cookies.md

Foothold

Vulnerability / Misconfiguration

  1. Comma-separated value formatting
  2. HTTP Cookie header manipulation
  3. Request parameter ordering
<command>

Exploitation

  • See original writeup content for detailed exploitation.

Privilege Escalation

Enumeration

sudo -l
find / -perm -4000 2>/dev/null
getcap -r / 2>/dev/null
cat /etc/crontab
ps aux

Exploitation

  1. N/A for challenge-type writeup; see exploitation above.
  2. Flag obtained via challenge solve.
<command>

Flags

FlagLocationValue
flagREDACTED

Key Takeaways / Lessons

  • Comma-separated value formatting
  • HTTP Cookie header manipulation
  • Request parameter ordering
  • Tags: http_cookies, cookie_manipulation, comma_separated_values, request_formatting, web_basics

Original Writeup

<details><summary>Click to expand original content</summary>

Description

"Я не представляю свою жизнь без печений. Кстати, в одной пачке они хорошо смотрятся"

(Translation: "I can't imagine my life without cookies. By the way, they look good in one pack")

Target: http://62.173.140.174:16047/

Analysis

The web page displayed a message with required cookies:

  • Sugar cookies = 1 amount
  • Oatmeal cookies = 5 amounts
  • Crackers cookies = 2 amounts

The key hint in the description — "в одной пачке" (in one pack) — indicated that all values should be combined/packed together. ‍​‌‌​​​​‌​‌‌​​‌‌​​‌‌​​‌‌​​‌‌​​‌​​​​‌‌​​​​​‌‌​​‌‌​​‌‌​​‌​‌​‌‌​​‌​‌‍

Key Observations

  1. Multiple values — need to pass several types of cookies with different amounts
  2. "In one pack" format — values should be combined with commas
  3. Order matters — cookies and amount must correspond to each other by position

Solution

The solution was to send HTTP cookies with comma-separated values:

curl -b "cookies=Sugar cookies,Oatmeal cookies,Crackers cookies; amount=1,5,2" \
     http://62.173.140.174:16047/

Request Structure

Cookie: cookies=Sugar cookies,Oatmeal cookies,Crackers cookies; amount=1,5,2

‍​‌‌​​​​‌​‌‌​​‌‌​​‌‌​​‌‌​​‌‌​​‌​​​​‌‌​​​​​‌‌​​‌‌​​‌‌​​‌​‌​‌‌​​‌​‌‍

Where:

  • cookies — list of cookie types separated by commas
  • amount — corresponding amounts separated by commas

Alternative Method (via browser)

In DevTools Console:

document.cookie = "cookies=Sugar cookies,Oatmeal cookies,Crackers cookies";
document.cookie = "amount=1,5,2";
location.reload();

Lessons

  1. Comma-separated cookies — non-standard but working way to pass multiple values
  2. Hints in description — "in one pack" directly indicated the format
  3. Order correspondence — positions in cookies and amount lists must match ‍​‌‌​​​​‌​‌‌​​‌‌​​‌‌​​‌‌​​‌‌​​‌​​​​‌‌​​​​​‌‌​​‌‌​​‌‌​​‌​‌​‌‌​​‌​‌‍

References

  • HTTP Cookies (MDN)
  • curl -b option ‍​‌‌​​​​‌​‌‌​​‌‌​​‌‌​​‌‌​​‌‌​​‌​​​​‌‌​​​​​‌‌​​‌‌​​‌‌​​‌​‌​‌‌​​‌​‌‍
</details>

Auto-tracked: saved to WriteUps; run /xesor-revise to fold lessons into XESXor_Methodology.md.

signed by XESXOR