Siguria

Path traversal

Në shqip: Kalimi jashtë dosjes

ShpjegimiSQ

Path traversal ndodh kur një aplikacion e merr emrin e skedarit nga përdoruesi pa e kontrolluar, dhe sulmuesi shkruan diçka si ../../etc/passwd për të lexuar skedarë jashtë dosjes së lejuar. Kontrollo gjithmonë që rruga mbetet brenda dosjes.

EnglishEN

Path traversal happens when an app takes a file name from the user without checking it, and the attacker types something like ../../etc/passwd to read files outside the allowed folder. Always check the path stays inside the folder.

Si ta mendosh

Si një mysafir që i thua „merr një libër nga rafti“ dhe ai shkon e hap sirtarët e dhomës tënde të gjumit.

Lexoje në anglisht

Like a guest you tell “take a book from the shelf” who goes and opens your bedroom drawers.

Shembull kodipython

from pathlib import Path
baza = Path("ngarkime").resolve()
skedari = (baza / emri_nga_perdoruesi).resolve()
if not skedari.is_relative_to(baza): raise PermissionError("Jo!")

Terma të lidhur