{"record":{"id":"b66e6e43f7ffb0df","repo":"shadow1ng/fscan","slug":"short-oracle-charset-negotiation","errorCode":null,"errorMessage":"short oracle charset negotiation","messagePattern":"short oracle charset negotiation","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/services/oracle_raw.go","lineNumber":1010,"sourceCode":"\tcharsetElem, err := s.getInt(2, false, false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif charsetElem > 0 {\n\t\tif _, err = s.getBytes(charsetElem * 5); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tlen1, err := s.getInt(2, false, true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnumArray, err := s.getBytes(len1)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(numArray) < 11 {\n\t\treturn nil, errors.New(\"short oracle charset negotiation\")\n\t}\n\toffset := int(6 + numArray[5] + numArray[6])\n\tif len(numArray) < offset+5 {\n\t\treturn nil, errors.New(\"short oracle ncharset negotiation\")\n\t}\n\tserverNCharset := int(binary.BigEndian.Uint16(numArray[offset+3 : offset+5]))\n\tlen2, err := s.getByte()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcompileCaps, err := s.getBytes(int(len2))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlen3, err := s.getByte()\n\tif err != nil {\n\t\treturn nil, err\n\t}","sourceCodeStart":992,"sourceCodeEnd":1028,"githubUrl":"https://github.com/shadow1ng/fscan/blob/95cc12e753bf43de7004e5aef42a9ffba3934303/plugins/services/oracle_raw.go#L992-L1028","documentation":"In protocolNegotiation the server sends a variable-length data array carrying its charset (and later NCHARSET) settings. This library requires at least 11 bytes to read the fixed fields plus offsets; a shorter array means the server's response is malformed or the client/server negotiated an unexpected protocol shape.","triggerScenarios":"protocolNegotiation() during oracleRawAuth calls s.getBytes(len1) and the returned numArray has fewer than 11 bytes.","commonSituations":"Truncated listener accept response over a lossy/proxied connection; unusual server builds that shorten the accept-data array; a desync from earlier mis-parsed negotiation fields.","solutions":["Re-run the connection; if intermittent, fix the network path (proxy/MTU/packet loss)","Verify prior negotiation fields were consumed with correct lengths — a length mis-parse shrinks numArray","Compare behavior across server versions/instances to identify a server-side anomaly and report it","Update plugin and Oracle client/server patch levels"],"exampleFix":"// before\nif len(numArray) < 11 {\n\treturn nil, errors.New(\"short oracle charset negotiation\")\n}\n// after\nif len(numArray) < 11 {\n\treturn nil, fmt.Errorf(\"short oracle charset negotiation: got %d bytes\", len(numArray))\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"short oracle charset negotiation\") {\n\t// often transient truncation; retry once, then investigate network\n\treturn retryWithBackoff(func() error { return connectAuth(dsn) }, 2)\n}","preventionTips":["Rule out transport truncation (proxy, MTU) before assuming a server bug","Keep plugin/server versions aligned to avoid accept-packet layout drift","If persistent, capture the accept packet for upstream bug reports"],"tags":["oracle","protocol","charset","negotiation"],"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-14T05:17:10.506Z"}