{"record":{"id":"365041d31c1e8ce2","repo":"shadow1ng/fscan","slug":"short-oracle-data-packet","errorCode":null,"errorMessage":"short oracle data packet","messagePattern":"short oracle data packet","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/services/oracle_raw.go","lineNumber":255,"sourceCode":"\t}\n\tvar length uint32\n\tif s.handshakeComplete && s.version >= 315 {\n\t\tlength = binary.BigEndian.Uint32(header[0:4])\n\t} else {\n\t\tlength = uint32(binary.BigEndian.Uint16(header[0:2]))\n\t}\n\tif length < 8 || length > 16*1024*1024 {\n\t\treturn nil, fmt.Errorf(\"invalid oracle packet length %d\", length)\n\t}\n\traw := make([]byte, length)\n\tcopy(raw, header)\n\tif err := s.readFull(raw[8:]); err != nil {\n\t\treturn nil, err\n\t}\n\tp := &oraclePacket{typ: raw[4], flag: raw[5], raw: raw}\n\tif p.typ == oraclePacketData {\n\t\tif len(raw) < 10 {\n\t\t\treturn nil, errors.New(\"short oracle data packet\")\n\t\t}\n\t\tp.data = raw[10:]\n\t\ts.in = append(s.in, p.data...)\n\t}\n\treturn p, nil\n}\n\nfunc (s *oracleSession) readFull(buf []byte) error {\n\tif s.timeout > 0 {\n\t\t_ = s.conn.SetReadDeadline(time.Now().Add(s.timeout))\n\t}\n\t_, err := io.ReadFull(s.conn, buf)\n\treturn err\n}\n\nfunc (s *oracleSession) writeRaw(ctx context.Context, buf []byte) error {\n\tif deadline, ok := ctx.Deadline(); ok {\n\t\t_ = s.conn.SetWriteDeadline(deadline)","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/shadow1ng/fscan/blob/95cc12e753bf43de7004e5aef42a9ffba3934303/plugins/services/oracle_raw.go#L237-L273","documentation":"readPacket parses a raw Oracle Net (TNS) packet from the wire. When the packet type is DATA (0x00), the data payload is expected to start at offset 10, so any DATA packet shorter than 10 bytes cannot carry a payload and this library rejects it rather than returning a corrupted packet. This indicates a truncated or malformed packet from the server or an intermediary.","triggerScenarios":"A DATA-type oracle packet arrives whose total length is < 10 bytes during connect() or any read() that refills the session buffer; typically the TCP stream returned a header-only or truncated frame.","commonSituations":"Unstable network links or proxy/LB idle timeouts slicing TNS frames; a middlebox misinterpreting the Oracle wire protocol; connecting to a non-Oracle service that echoes short frames; server crash mid-response.","solutions":["Verify network path stability between client and DB host (no proxy truncating TNS traffic); test with a direct connection to the listener host:port","Confirm the DSN points to a real Oracle listener port, not an HTTP or other service","Retry the connection; if intermittent, investigate MTU/VPN/firewall issues dropping tail bytes","Update the plugin and Oracle server/listener versions and retest; if reproducible on a healthy path, report with a tcpdump capture"],"exampleFix":"// before\nif p.typ == oraclePacketData {\n\tif len(raw) < 10 {\n\t\treturn nil, errors.New(\"short oracle data packet\")\n\t}\n\tp.data = raw[10:]\n}\n// after\nif p.typ == oraclePacketData {\n\tif len(raw) < 10 {\n\t\treturn nil, fmt.Errorf(\"short oracle data packet: got %d bytes\", len(raw))\n\t}\n\tp.data = raw[10:]\n}","handlingStrategy":"retry","validationCode":"// sanity-check reachability before opening the Oracle session\nconn, err := net.DialTimeout(\"tcp\", host+\":\"+port, 5*time.Second)\nif err != nil { return err }\nconn.Close()","typeGuard":null,"tryCatchPattern":"for attempt := 0; attempt < 3; attempt++ {\n\tsession, err := connect(dsn)\n\tif err != nil && strings.Contains(err.Error(), \"short oracle data packet\") {\n\t\ttime.Sleep(time.Duration(attempt+1) * time.Second)\n\t\tcontinue\n\t}\n\treturn session, err\n}\nreturn nil, errors.New(\"connection repeatedly returned truncated oracle packets\")","preventionTips":["Bypass or correctly configure proxies/LBs for Oracle TNS traffic","Watch for MTU/VPN fragmentation issues on the DB path","Monitor for intermittent truncation; it signals network instability, not an app bug"],"tags":["oracle","network","protocol","truncated-packet"],"backgroundTag":"unexpected-response-shape","analyzedSha":"95cc12e753bf43de7004e5aef42a9ffba3934303","analyzedAt":"2026-09-06T17:07:30.094Z","contentChangedAt":"2026-09-06T17:07:30.094Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}