{
    "title": "Bestandsinclusie (LFI / RFI)",
    "seo_title": "Bestandsinclusie (LFI / RFI): betekenis en bescherming",
    "h1": "Bestandsinclusie (LFI / RFI)",
    "description": "Bestandsinclusie uitgelegd: hoe LFI en RFI include en require in PHP misbruiken, welke PHP-instellingen meetellen en hoe je WordPress ertegen beschermt.",
    "lead": "Bestandsinclusie is een PHP-kwetsbaarheid waarbij een aanvaller het pad bepaalt dat aan include of require wordt doorgegeven. Bij LFI (Local File Inclusion) laat hij een bestand laden dat al op de server staat, bij RFI (Remote File Inclusion) een bestand dat ergens anders wordt gehost. Het leidt tot het uitlezen van geheimen of het uitvoeren van code.",
    "language": "nl",
    "locale": "nl-NL",
    "type": "definition",
    "url": "https://www.wp-feint.com/nl/woordenlijst/bestandsinclusie/",
    "canonical": "https://www.wp-feint.com/nl/woordenlijst/bestandsinclusie/",
    "markdown": "https://www.wp-feint.com/nl/woordenlijst/bestandsinclusie/index.md",
    "json": "https://www.wp-feint.com/nl/woordenlijst/bestandsinclusie/index.json",
    "published": "2026-10-28T08:00:00+00:00",
    "modified": "2026-11-22T12:07:44+00:00",
    "site": {
        "name": "WP Feint",
        "url": "https://www.wp-feint.com/nl/"
    },
    "translations": [
        {
            "language": "nl",
            "hreflang": "nl-NL",
            "title": "Bestandsinclusie (LFI / RFI)",
            "url": "https://www.wp-feint.com/nl/woordenlijst/bestandsinclusie/",
            "markdown": "https://www.wp-feint.com/nl/woordenlijst/bestandsinclusie/index.md",
            "json": "https://www.wp-feint.com/nl/woordenlijst/bestandsinclusie/index.json"
        },
        {
            "language": "en",
            "hreflang": "en-US",
            "title": "File inclusion (LFI / RFI)",
            "url": "https://www.wp-feint.com/glossary/file-inclusion/",
            "markdown": "https://www.wp-feint.com/glossary/file-inclusion/index.md",
            "json": "https://www.wp-feint.com/glossary/file-inclusion/index.json"
        },
        {
            "language": "fr",
            "hreflang": "fr-FR",
            "title": "Inclusion de fichiers (LFI / RFI)",
            "url": "https://www.wp-feint.com/fr/definitions/inclusion-de-fichiers/",
            "markdown": "https://www.wp-feint.com/fr/definitions/inclusion-de-fichiers/index.md",
            "json": "https://www.wp-feint.com/fr/definitions/inclusion-de-fichiers/index.json"
        },
        {
            "language": "es",
            "hreflang": "es-ES",
            "title": "Inclusión de archivos (LFI / RFI)",
            "url": "https://www.wp-feint.com/es/glosario/inclusion-de-archivos/",
            "markdown": "https://www.wp-feint.com/es/glosario/inclusion-de-archivos/index.md",
            "json": "https://www.wp-feint.com/es/glosario/inclusion-de-archivos/index.json"
        },
        {
            "language": "de",
            "hreflang": "de-DE",
            "title": "Dateieinbindung (LFI / RFI)",
            "url": "https://www.wp-feint.com/de/glossar/dateieinbindung/",
            "markdown": "https://www.wp-feint.com/de/glossar/dateieinbindung/index.md",
            "json": "https://www.wp-feint.com/de/glossar/dateieinbindung/index.json"
        },
        {
            "language": "it",
            "hreflang": "it-IT",
            "title": "File inclusion (LFI e RFI)",
            "url": "https://www.wp-feint.com/it/glossario/file-inclusion/",
            "markdown": "https://www.wp-feint.com/it/glossario/file-inclusion/index.md",
            "json": "https://www.wp-feint.com/it/glossario/file-inclusion/index.json"
        },
        {
            "language": "pt",
            "hreflang": "pt-BR",
            "title": "Inclusão de arquivos (LFI / RFI)",
            "url": "https://www.wp-feint.com/pt/glossario/inclusao-de-arquivos/",
            "markdown": "https://www.wp-feint.com/pt/glossario/inclusao-de-arquivos/index.md",
            "json": "https://www.wp-feint.com/pt/glossario/inclusao-de-arquivos/index.json"
        }
    ],
    "headings": [
        {
            "level": 1,
            "text": "Bestandsinclusie (LFI / RFI)"
        },
        {
            "level": 2,
            "text": "Hoe de aanval werkt"
        },
        {
            "level": 2,
            "text": "De rol van de PHP-configuratie"
        },
        {
            "level": 2,
            "text": "Hoe je je ertegen beschermt"
        },
        {
            "level": 2,
            "text": "Voor WordPress"
        }
    ],
    "body": "In PHP laden de instructies `include` en `require` (en hun varianten `_once`) een bestand en voeren ze de code daarin uit. Ze worden overal gebruikt, bijvoorbeeld om een template van een thema te laden. Het gevaar ontstaat wanneer het pad van het bestand afhangt van gegevens die een bezoeker zonder voldoende controle meestuurt. De MITRE-catalogus deelt deze zwakte in onder CWE-98, met twee gangbare namen: RFI voor inclusie op afstand, LFI voor lokale inclusie.\n\n## Hoe de aanval werkt\n\nCode zoals deze laat de bezoeker kiezen welk bestand er wordt geladen:\n\n```\n// Niet doen\ninclude( __DIR__ . '/templates/' . $_GET['weergave'] . '.php' );\n```\n\n- **LFI (Local File Inclusion)**: met reeksen als `../` klimt de aanvaller omhoog in de mappenstructuur en laat hij een bestand laden dat al op de server staat. In het beste geval leest hij een bestand dat hij niet hoort te zien; lukt het hem een bestand te laten includen waarvan hij de inhoud bepaalt (een logbestand, een geüpload bestand), dan krijgt hij [remote code execution](https://www.wp-feint.com/nl/woordenlijst/remote-code-execution/).\n- **RFI (Remote File Inclusion)**: de aanvaller geeft een URL naar zijn eigen server op en PHP voegt zijn code direct in. Dat is de meest directe vorm, maar er is een optie voor nodig die zelden aanstaat.\n\n![Vergelijking in drie kolommen: LFI (inclusie van een bestand op de server, wp-config.php uitgelezen of uitgevoerd via ../-paden, wrappers php://filter en phar://, werkt met de standaardconfiguratie), RFI (inclusie van een http- of ftp-URL met de code van de aanvaller, vereist dat allow_url_include aanstaat, een optie die standaard uitstaat en sinds PHP 7.4 verouderd is) en verweer (vaste lijst toegestane bestanden, nooit een pad uit het verzoek, open_basedir en allow_url_include uit, updates)](https://www.wp-feint.com/media/2026/10/lfi-rfi-nl.webp)\n\n## De rol van de PHP-configuratie\n\nDe PHP-documentatie is duidelijk over twee instellingen:\n\n- `allow_url_include` staat URL's toe in `include` en `require`. De standaardwaarde is `0`, je kunt hem alleen in de systeemconfiguratie (php.ini) wijzigen en hij is verouderd sinds PHP 7.4.0. Hij vereist ook dat `allow_url_fopen` aanstaat.\n- `allow_url_fopen` maakt het mogelijk URL's te openen alsof het bestanden zijn; deze optie staat standaard aan, omdat veel scripts haar nodig hebben.\n\nRFI uitschakelen lost niet alles op: met de wrappers van PHP, zoals `php://filter`, kun je op een standaardconfiguratie sommige LFI's omzetten in het uitvoeren van code, en `phar://` werd lange tijd gebruikt om een [onveilige deserialisatie](https://www.wp-feint.com/nl/woordenlijst/onveilige-deserialisatie/) te starten. [Ons artikel over de wrappers php://filter en phar](https://www.wp-feint.com/nl/bestandsinclusie-php-wrappers/) beschrijft die technieken.\n\n## Hoe je je ertegen beschermt\n\nHet beste verweer, dat ook MITRE aanraadt, is nooit een pad op te bouwen uit ontvangen gegevens, maar vaste waarden te koppelen aan bekende bestanden:\n\n```\n$weergaven = array( 'lijst' => 'lijst.php', 'raster' => 'raster.php' );\n$weergave  = isset( $weergaven[ $_GET['weergave'] ?? '' ] ) ? $weergaven[ $_GET['weergave'] ] : 'lijst.php';\ninclude __DIR__ . '/templates/' . $weergave;\n```\n\n- Houd bestanden die worden ingevoegd waar mogelijk buiten de webroot.\n- Beperk met `open_basedir` wat PHP mag lezen: een misbruikte inclusie kan dan niet buiten de toegestane mappen komen. PHP harden bij je hostingprovider legt deze instelling en de gevolgen uit.\n- Een [web application firewall](https://www.wp-feint.com/nl/woordenlijst/waf/) blokkeert typische patronen (`../`, `php://`), maar alleen als aanvulling.\n\n## Voor WordPress\n\nDe WordPress-core bouwt zijn inclusies niet op uit parameters van bezoekers: het risico komt van plugins en thema's die een template, een taal of een module laden op basis van een URL- of AJAX-parameter. Het favoriete doelwit van een LFI is `wp-config.php`, met de toegangsgegevens van de database en de beveiligingssleutels; een vergeten gevoelig bestand in de root, zoals een `.env` of een back-up, is een ander makkelijk doelwit, zoals [ons artikel over blootgestelde gevoelige bestanden](https://www.wp-feint.com/nl/blootgestelde-gevoelige-bestanden/) laat zien. Controleer ten slotte of je hostingprovider `allow_url_include` uitgeschakeld laat.\n\n## Gerelateerde termen\n\n- [Remote code execution (RCE)](https://www.wp-feint.com/nl/woordenlijst/remote-code-execution/)\n- [Onveilige deserialisatie](https://www.wp-feint.com/nl/woordenlijst/onveilige-deserialisatie/)\n- [WAF (web application firewall)](https://www.wp-feint.com/nl/woordenlijst/waf/)\n- [Backdoor (achterdeur)](https://www.wp-feint.com/nl/woordenlijst/backdoor/)\n\n\n## Bronnen\n\n- [MITRE CWE-98 : PHP Remote File Inclusion](https://cwe.mitre.org/data/definitions/98.html)\n- [PHP Manual : Filesystem and Streams Configuration Options](https://www.php.net/manual/en/filesystem.configuration.php)\n- [PHP Manual : Backward Incompatible Changes in PHP 8.0 (Phar)](https://www.php.net/manual/en/migration80.incompatible.php)",
    "definition": "Bestandsinclusie is een PHP-kwetsbaarheid waarbij een aanvaller het pad bepaalt dat aan include of require wordt doorgegeven. Bij LFI (Local File Inclusion) laat hij een bestand laden dat al op de server staat, bij RFI (Remote File Inclusion) een bestand dat ergens anders wordt gehost. Het leidt tot het uitlezen van geheimen of het uitvoeren van code.",
    "group": "Webbeveiliging",
    "aka": [
        "LFI",
        "RFI",
        "Local File Inclusion",
        "Remote File Inclusion",
        "file inclusion",
        "CWE-98"
    ],
    "related": [
        {
            "title": "Remote code execution (RCE)",
            "url": "https://www.wp-feint.com/nl/woordenlijst/remote-code-execution/",
            "markdown": "https://www.wp-feint.com/nl/woordenlijst/remote-code-execution/index.md"
        },
        {
            "title": "Onveilige deserialisatie",
            "url": "https://www.wp-feint.com/nl/woordenlijst/onveilige-deserialisatie/",
            "markdown": "https://www.wp-feint.com/nl/woordenlijst/onveilige-deserialisatie/index.md"
        },
        {
            "title": "WAF (web application firewall)",
            "url": "https://www.wp-feint.com/nl/woordenlijst/waf/",
            "markdown": "https://www.wp-feint.com/nl/woordenlijst/waf/index.md"
        },
        {
            "title": "Backdoor (achterdeur)",
            "url": "https://www.wp-feint.com/nl/woordenlijst/backdoor/",
            "markdown": "https://www.wp-feint.com/nl/woordenlijst/backdoor/index.md"
        }
    ],
    "sources": [
        {
            "title": "MITRE CWE-98 : PHP Remote File Inclusion",
            "url": "https://cwe.mitre.org/data/definitions/98.html"
        },
        {
            "title": "PHP Manual : Filesystem and Streams Configuration Options",
            "url": "https://www.php.net/manual/en/filesystem.configuration.php"
        },
        {
            "title": "PHP Manual : Backward Incompatible Changes in PHP 8.0 (Phar)",
            "url": "https://www.php.net/manual/en/migration80.incompatible.php"
        }
    ],
    "format": "application/json"
}