Access control vulnerabilities
Access Control Vulnerabilities aur Privilege Escalation
Is section mein hum cover karenge:
- Privilege Escalation kya hota hai.
- Access Control se related jo vulnerabilities hoti hain, unke types.
- Access Control Vulnerabilities ko kaise prevent karein.
Labs
Agar aapko Access Control Vulnerabilities ke basic concepts ka knowledge hai aur aap inhe realistic, deliberately vulnerable targets par exploit karna chahte hain, toh aap niche diye gaye link se labs access kar sakte hain.
Access Control Kya Hota Hai?
Access Control ka matlab hai constraints apply karna taaki ye ensure kiya ja sake ki kaun ya kya kisi action ko perform karne ya kisi resource ko access karne ke liye authorized hai.
Web Applications ke context mein, Access Control teen major cheezon par depend karta hai:
- Authentication: Ye confirm karta hai ki user wahi hai jo wo claim kar raha hai.
- Session Management: Ye identify karta hai ki konsi subsequent HTTP requests usi user dwara ki ja rahi hain.
- Access Control: Ye decide karta hai ki user jo action perform karna chahta hai, usko allow kiya jaana chahiye ya nahi.
Broken Access Control
Broken Access Controls bahut common hote hain aur ye critical security vulnerability create kar sakte hain.
Access Control ka Design aur Management ek complex aur dynamic process hai jisme business, organizational aur legal constraints ko technical implementation ke saath align karna hota hai.
Access Control ka design human decisions par depend karta hai, is wajah se errors hone ka chance high hota hai.

Vertical Access Controls
Vertical access controls aise mechanisms hote hain jo sensitive functionality ka access sirf specific types ke users tak limit karte hain.
Isme different types ke users ko alag-alag application functions ka access diya jata hai. Example ke liye, ek administrator kisi bhi user ka account modify ya delete kar sakta hai, jabki ek ordinary user ke paas ye permissions nahi hoti.
Vertical access controls security models ka ek fine-grained implementation hote hain jo business policies jaise ki separation of duties aur least privilege ko enforce karne ke liye design kiye jate hain.
Example of Vertical Access Controls
Maan lo ek banking application hai jisme teen types ke users hain:
- Customer β Apne account ka balance check kar sakta hai aur fund transfer kar sakta hai.
- Bank Employee β Customer ke account details dekh sakta hai aur unke transactions verify kar sakta hai.
- Administrator (Bank Manager) β Kisi bhi customer ka account modify, suspend ya delete kar sakta hai.
π Scenario:
Agar ek customer bank manager ka role access karne ki koshish kare, toh system usko access denied message dega kyunki uske paas required privileges nahi hain. Yehi Vertical Access Control ka kaam hai β har user ko sirf uske role ke hisaab se functions ka access milta hai.

Horizontal Access Controls
Horizontal access controls aise mechanisms hote hain jo resources ka access sirf specific users tak limit karte hain.
Isme same type ke resources hote hain, lekin har user ko sirf uske khud ke resources ka access milta hai.
Example:
Ek banking application me:
- User A sirf apne bank account transactions dekh sakta hai aur payments kar sakta hai.
- User B apne account ke transactions dekh sakta hai, lekin User A ke account ka access nahi hoga.
π Scenario:
Agar User A kisi dusre user (User B) ka account access karne ki koshish kare, toh system usko access denied message dega, kyunki uske paas authorization nahi hai.
Horizontal Access Controls ensure karte hain ki users ek hi type ke resources ka access karein, lekin sirf apne khud ke resources tak limited rahein. π
Context-Dependent Access Controls
Context-dependent access controls aise controls hote hain jo application ke state ya user ke interaction ke basis par access ko restrict karte hain.
Ye controls ensure karte hain ki koi user galat order me actions perform na kare.
Example:
Ek retail website me:
- User shopping cart me items add kar sakta hai.
- Payment hone ke baad user shopping cart modify nahi kar sakta.
π Scenario:
Agar user payment karne ke baad cart me changes karne ki koshish kare, toh system modification allow nahi karega.
Context-Dependent Access Controls ensure karte hain ki users sirf allowed context me hi actions perform kar sakein. π
Examples of Broken Access ControlsΒ
Broken access control vulnerabilities tab hoti hain jab koi user aise resources ya actions access kar sakta hai jo uske authorized nahi hote.
Vertical Privilege Escalation
Agar ek user aisi functionality access kar sake jo uske liye allowed nahi hai, to ise vertical privilege escalation kehte hain.
π Example: Agar ek non-administrative user kisi admin page ka access le sake jahan wo user accounts delete kar sakta hai, to ye vertical privilege escalation ka case hoga.
Unprotected Functionality
Basic level par, vertical privilege escalation tab hota hai jab application kisi sensitive functionality ke liye koi protection enforce nahi karti.
π Example: Ek website me admin functions sirf admin ke welcome page par dikhaye gaye hain, lekin ek normal user bhi direct URL se admin functions ko access kar sakta hai.
Kisi website ka sensitive functionality host karna kuch is tarah ho sakta hai:
π https://insecure-website.com/admin
Agar ye URL kisi bhi user ke liye accessible hai, to ye security vulnerability hai.
Kahi baar ye robots.txt file me bhi disclose ho sakta hai:
π https://insecure-website.com/robots.txt
Agar URL kahin disclosed nahi bhi hai, to attacker ek wordlist ka use karke brute-force kar sakta hai aur sensitive functionality locate kar sakta hai.
Security by ObscurityΒ
Kayi cases me, sensitive functionality ko chhupane ke liye uska less predictable URL diya jata hai. Is technique ko “security by obscurity” kehte hain.
Lekin sirf URL ko obfuscate karna effective access control nahi deta, kyunki users alag-alag tareekon se is URL ko discover kar sakte hain.
π Example:
Agar ek application apni admin functionalities ko is URL par host karti hai:
π https://insecure-website.com/administrator-panel-yb556
To ye directly guess karna mushkil ho sakta hai, lekin application khud hi users ko ye URL leak kar sakti hai.
Kayi baar, JavaScript code me bhi ye URL expose ho sakta hai. Example dekhiye:
var isAdmin = false;
if (isAdmin) {
…
var adminPanelTag = document.createElement(‘a’);
adminPanelTag.setAttribute(‘href’, ‘https://insecure-website.com/administrator-panel-yb556’);
adminPanelTag.innerText = ‘Admin panel’;
…
}
</script>
π Issue:
Ye script admin users ke UI me link add karti hai agar isAdmin = true ho.
Lekin ye script sabhi users ke liye visible hoti hai, chahe wo admin ho ya na ho.
β Solution: Proper access controls enforce karna zaroori hai, sirf URL chhupane se security ensure nahi hoti.
Parameter-based Access Control MethodsΒ
Kuch applications user ke access rights ya role ko login ke time determine karti hain aur fir is information ko user-controllable location me store karti hain, jaise ki:
- Hidden field
- Cookie
- Preset query string parameter
Fir application submitted value ke basis par access control decisions leti hai.
π Example:
π https://insecure-website.com/login/home.jsp?admin=true
π https://insecure-website.com/login/home.jsp?role=1
β Issue:
Ye approach insecure hai, kyunki user is value ko modify kar sakta hai aur unauthorized functionality access kar sakta hai, jaise administrative functions.
β Solution: Proper server-side access control implement karna zaroori hai, taaki user-controlled parameters manipulate karke unauthorized access na le sake.
Broken Access Control due to Platform MisconfigurationΒ
Kuch applications platform level par access controls enforce karti hain. Ye user ke role ke basis par specific URLs aur HTTP methods restrict karne ka kaam karti hain.
π Example:
Ek application kisi rule ko is tarah configure kar sakti hai:
DENY: POST, /admin/deleteUser, managers
πΉ Iska matlab:
Ye rule managers group ke users ko /admin/deleteUser
URL par POST request bhejne se rokta hai.
β Issue: Access Control Bypass
Is approach me galtiyan ho sakti hain, jisme attackers access controls bypass kar sakte hain.
Kuch application frameworks non-standard HTTP headers support karte hain jo original request ke URL ko override kar sakte hain, jaise:
- X-Original-URL
- X-Rewrite-URL
Agar ek website sirf front-end par strict URL restrictions lagati hai, lekin backend request headers allow karta hai URL override hone ko, to access control bypass ho sakta hai.
π Example Request:
POST / HTTP/1.1
X-Original-URL: /admin/deleteUser
...
β
Solution:
1οΈβ£ Back-end level par strict access control implement karein.
2οΈβ£ Non-standard HTTP headers ka misuse hone se bachane ke liye validation karein.
3οΈβ£ Only server-side authentication and authorization mechanisms use karein.
Alternative Attack: HTTP Method ManipulationΒ
Ek alternative attack HTTP method par depend karta hai jo request me use hoti hai.
Jo front-end controls pehle explain kiye gaye hain, wo URL aur HTTP method ke basis par access restrict karte hain.
Lekin kuch websites alag-alag HTTP request methods ko tolerate karti hain jab koi action perform kiya jata hai.
π Agar ek attacker restricted URL par GET (ya koi aur method) use karke action perform kar sake, to wo platform-level access controls bypass kar sakta hai.
Broken Access Control due to URL-Matching DiscrepanciesΒ
Alag-alag websites incoming request ke path ko match karne ke tareeke me differ karti hain.
π Example:
Agar ek website capitalization tolerate karti hai, to /ADMIN/DELETEUSER
request automatically /admin/deleteUser
endpoint par map ho sakti hai.
β Issue: Agar access control mechanism strict na ho, to ye endpoints alag-alag treat ho sakte hain, aur restrictions sahi se enforce nahi hongi.
Spring Framework me Security Issue
Spring framework me agar useSuffixPatternMatch option enable ho, to koi bhi random file extension wali request ek valid endpoint se match ho sakti hai.
π Example:
π /admin/deleteUser.anything
Ye request /admin/deleteUser se match ho jayegi.
π‘ Spring 5.3 se pehle ye option by default enabled hoti thi!
Trailing Slash Bypass
Kuch systems /admin/deleteUser aur /admin/deleteUser/ ko alag treat karte hain.
Agar access control ek format par enforce ho raha hai, to dusre format me bypass ho sakta hai.
Horizontal Privilege EscalationΒ
Agar ek user apne resources ke alawa kisi aur user ke resources access kar sake, to ise horizontal privilege escalation kehte hain.
π Example:
π https://insecure-website.com/myaccount?id=123
Agar attacker id=123
ko id=456
se replace kare, to wo dusre user ka account access kar sakta hai.
π Ye ek IDOR (Insecure Direct Object Reference) vulnerability ka example hai!
IDOR (Insecure Direct Object References)
IDOR ek access control vulnerability hai jisme user-controlled parameters ko objects access karne ke liye directly use kiya jata hai.
β Example Attack:
Predictable IDs: Agar website me sequential user IDs ho (123, 124, 125…), to attacker easily guess karke dusre users ke data ko access kar sakta hai.
GUIDs ka use: Agar random GUIDs use kiye jayein (
f5a3b9c7-8d12
), to attackers ke liye guessing mushkil ho jati hai.
π‘ Lekin agar application kahin aur GUIDs leak kar rahi ho (messages, reviews, etc.), to attackers inhe discover kar sakte hain!
Redirect Data Leakage
Kayi baar website unauthorized users ko login page par redirect karti hai, lekin redirect response me sensitive data leak ho sakta hai!
Horizontal to Vertical Privilege Escalation
Agar attacker kisi zyada privileged user ka account hack kar le, to horizontal escalation vertical escalation ban sakti hai.
π Example:
π https://insecure-website.com/myaccount?id=456
Agar id=456 ek admin user ka hai, to attacker admin functionalities tak access le sakta hai.
Admin page par password reset ka option ho sakta hai.
Admin panel me sensitive data ya functionalities ho sakti hain.
Access Control in Multi-Step Processes
Kayi websites me multi-step processes hote hain, jaise:
1οΈβ£ Form load karna (user details show karna)
2οΈβ£ Changes submit karna
3οΈβ£ Changes review karna aur confirm karna
β Issue: Agar website pehle do steps me access control enforce kare, lekin last step me na kare, to attacker pehle steps skip karke direct last step me request bhej sakta hai.
Referer-Based Access Control Bypass
Kuch websites Referer header ke basis par access control enforce karti hain.
π Example:
Main admin page (
/admin
) par proper access control hai.Sub-pages (
/admin/deleteUser
) sirf Referer check karti hain.
β Issue: Attacker forged request bhejkar fake Referer header add kar sakta hai aur unauthorized access le sakta hai!
Location-Based Access Control Bypass
Kuch websites user ke geographical location ke basis par access control implement karti hain (banking apps, media services, etc.).
π‘ Attackers ise bypass kar sakte hain:
β
VPN ya proxy servers use karke
β
Client-side geolocation modify karke
Access Control Vulnerabilities Ka Prevention
Access control vulnerabilities ko prevent karne ke liye defense-in-depth approach follow karein:
β
Kabhi bhi sirf obfuscation (chhupane) par bharosa na karein.
β
Jo resource public nahi hona chahiye, usko by default deny karein.
β
Ek centralized access control mechanism use karein.
β
Code level par access control rules enforce karein.
β
Regularly audit aur test karein ki access controls sahi kaam kar rahe hain.
1οΈβ£ Question:
π Access Control kya hota hai? Kyu important hai?
β Answer:
Access Control ek security mechanism hai jo users ke access ko restrict karta hai based on their roles aur permissions. Iska main purpose unauthorized access ko prevent karna hota hai.
β‘ Types of Access Control:
Discretionary Access Control (DAC) β User apne data par control rakh sakta hai.
Mandatory Access Control (MAC) β Strict security policies enforced hoti hain (Military-grade).
Role-Based Access Control (RBAC) β Access based on user’s role (Admin, User, Guest, etc.).
Attribute-Based Access Control (ABAC) β Access dynamic attributes jaise time, location, and device ke basis par hota hai.
β
Example:
Agar ek banking application me normal user admin panel access kar sake, to ye access control vulnerability hogi.
2οΈβ£ Question:
π IDOR vulnerability kya hoti hai? Iska real-world example do.
β Answer:
IDOR (Insecure Direct Object Reference) ek access control vulnerability hai jisme user-controlled input ka sahi validation nahi hota, jiske wajah se unauthorized data access ho sakta hai.
β‘ Example:
π https://bank.com/myaccount?id=123
Agar ek attacker id=123
ko id=456
me change kare aur kisi aur user ka account details dekh sake, to ye IDOR vulnerability hogi.
β
Real-World Example:
Facebook me ek bug mila tha jisme ek user dusre user ke private photos ko access kar sakta tha sirf URL manipulate karke.
3οΈβ£ Question:
π IDOR vulnerability ka detection kaise karte hain?
β Answer:
IDOR vulnerability ko detect karne ke liye manual testing aur automated tools dono use kiye jate hain.
πΉ Manual Testing:
Parameter Tampering: URL me ID change karke test karna.
Session Manipulation: Different user ke session se access check karna.
API Testing: API requests me input modify karke unauthorized access check karna.
πΉ Automated Tools:
β
Burp Suite β ID tampering aur API fuzzing ke liye use hota hai.
β
OWASP ZAP β Automated IDOR detection ke liye use hota hai.
4οΈβ£ Question:
π Access Control Bypass ka ek real-world scenario batao.
β Answer:
Agar ek website admin panel ka link directly user interface me na dikhaye, lekin actual admin URL accessible ho, to access control bypass possible ho sakta hai.
β‘ Example:
π https://secure-website.com/admin
Agar ek non-admin user bhi direct URL access karke admin panel me ghus sake, to ye broken access control vulnerability hogi.
β Fix:
Proper authentication aur authorization check implement karna.
Server-side access controls enforce karna.
5οΈβ£ Question:
π Horizontal aur Vertical Privilege Escalation me kya difference hai?
β Answer:
πΉ Horizontal Privilege Escalation β Jab ek user kisi aur user ke resources ko access kar sake.
πΉ Vertical Privilege Escalation β Jab ek user higher privilege (admin) ka access le sake.
β Example:
Horizontal: Ek normal employee doosre employee ka payroll data dekh sake.
Vertical: Ek normal user admin panel access kar sake.
6οΈβ£ Question:
π Referer Header Bypass se Access Control kaise break ho sakta hai?
β Answer:
Kayi websites Referer header ke basis par access control enforce karti hain. Lekin attacker forged request me fake Referer header daal kar bypass kar sakta hai.
β‘ Example:
Agar ek website /admin/deleteUser
ko sirf tab allow kare jab Referer /admin
ho, to attacker manually forged request bhejkar access le sakta hai.
β Fix:
Referer-based access control use na karein.
Proper authentication aur authorization check enforce karein.
7οΈβ£ Question:
π Kya sirf Obfuscation Access Control enforce karne ke liye sahi hai?
β Answer:
β Nahi! Obfuscation access control enforce karne ka reliable method nahi hai.
β‘ Example:
Agar admin panel ka URL random aur non-guessable ho (/admin-panel-xyz123
), to bhi attacker wordlist ya robots.txt file se isse discover kar sakta hai.
β Fix:
Proper authentication aur authorization check implement karein.
Direct admin access ko block karein aur role-based access control enforce karein.
8οΈβ£ Question:
π Access Control vulnerabilities ka prevention kaise hota hai?
β Answer:
Access control vulnerabilities ko prevent karne ke liye best security practices follow karni chahiye:
β
Least Privilege Principle β Har user ko sirf utne permissions mile jitna required hai.
β
Server-side Authorization Checks β Frontend pe sirf UI controls na ho, backend pe access validation zaroor ho.
β
RBAC (Role-Based Access Control) β Har user role ke basis par access define karein.
β
Access Control Testing β Regular penetration testing aur security audits karein.
π― Conclusion
Agar aap cybersecurity interview ke liye prepare kar rahe hain, to Access Control aur IDOR vulnerabilities ke concepts, real-world examples aur prevention techniques ache se samajhna zaroori hai.