{"record":{"id":"91c904a7db99f558","repo":"shadow1ng/fscan","slug":"oracle-advanced-negotiation-header-mismatch","errorCode":null,"errorMessage":"oracle advanced negotiation header mismatch","messagePattern":"oracle advanced negotiation header mismatch","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/services/oracle_raw.go","lineNumber":799,"sourceCode":"}\n\nfunc (s *oracleSession) writeANOUB2Array(v []int) {\n\ts.writeANOPacketHeader(10+len(v)*2, 1)\n\ts.putInt(uint64(0xdeadbeef), 4, true, false)\n\ts.putInt(3, 2, true, false)\n\ts.putInt(len(v), 4, true, false)\n\tfor _, n := range v {\n\t\ts.putInt(n, 2, true, false)\n\t}\n}\n\nfunc (s *oracleSession) readANOHeader() (*oracleANOHeader, error) {\n\tmagic, err := s.getInt64(4, false, true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif magic != 0xdeadbeef {\n\t\treturn nil, errors.New(\"oracle advanced negotiation header mismatch\")\n\t}\n\tif _, err = s.getInt(2, false, true); err != nil {\n\t\treturn nil, err\n\t}\n\tif _, err = s.getInt(4, false, true); err != nil {\n\t\treturn nil, err\n\t}\n\tcount, err := s.getInt(2, false, true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif _, err = s.getByte(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &oracleANOHeader{serviceCount: count}, nil\n}\n\nfunc (s *oracleSession) readANOServiceHeader() (int, int, int, error) {","sourceCodeStart":781,"sourceCodeEnd":817,"githubUrl":"https://github.com/shadow1ng/fscan/blob/95cc12e753bf43de7004e5aef42a9ffba3934303/plugins/services/oracle_raw.go#L781-L817","documentation":"The Advanced Negotiation (ANO) exchange begins with a fixed magic marker 0xdeadbeef. readANOHeader reads a 4-byte big-endian integer and fails immediately if it does not equal this magic, meaning the server's response stream is not aligned where ANO data is expected.","triggerScenarios":"advancedNegotiation() (or TestReadANOHeader/TestReadANOHeaderBadMagic) calls readANOHeader and the next 4 bytes in the buffer are not 0xdeadbeef — the server skipped, re-ordered, or never sent the ANO header.","commonSituations":"Connecting to an Oracle server version/edition that does not support advanced negotiation; a previous parsing step desynchronized the byte stream; a proxy altering the TNS payload.","solutions":["Verify server Oracle version supports ANO; if not, disable advanced negotiation in connection options if the plugin exposes such a flag","Check that all prior negotiation steps (protocol/charset) succeeded and consumed exactly the expected bytes — a desync here shifts the magic","Capture traffic and compare the ANO exchange against a working client (e.g. sqlplus) from the same host","Report/upstream if the server consistently omits the header despite supporting ANO"],"exampleFix":"// before\nmagic, err := s.getInt64(4, false, true)\nif err != nil {\n\treturn nil, err\n}\nif magic != 0xdeadbeef {\n\treturn nil, errors.New(\"oracle advanced negotiation header mismatch\")\n}\n// after\nmagic, err := s.getInt64(4, false, true)\nif err != nil {\n\treturn nil, err\n}\nif magic != 0xdeadbeef {\n\treturn nil, fmt.Errorf(\"oracle advanced negotiation header mismatch: got %#x\", magic)\n}","handlingStrategy":"try-catch","validationCode":"// ensure the target supports ANO by testing a plain login first\nif err := testPlainLogin(dsn); err != nil { return err }","typeGuard":null,"tryCatchPattern":"_, err := advancedNegotiation(s)\nif err != nil && strings.Contains(err.Error(), \"advanced negotiation header mismatch\") {\n\treturn fallbackWithoutANO(s) // reconnect with ANO disabled, if supported\n}","preventionTips":["Confirm server version supports advanced negotiation before enabling it","Keep plugin and server patch levels aligned to avoid wire-format drift","If the error is consistent, suspect a parsing desync earlier in the handshake"],"tags":["oracle","protocol","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-14T00:17:10.932Z"}