[ 
https://issues.apache.org/jira/browse/DIRSERVER-2426?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18152494#comment-18152494
 ] 

Emmanuel Lécharny commented on DIRSERVER-2426:
----------------------------------------------

Hi,

those three protocols where addd 20 years back, as a demonstration that we can 
build a server backed by a LDAP repository to store the data, which support 
multiple protocols, like NTP, DNS or DHCP.

It never went any further, the work stop there.

The code is by any leans lacking some serious verification and checking. 
Typically, in the check you have done, it shows that decoding an incoming 
request is done without taking any care of the received content: we keep going, 
asking the decoder to get some data from the message, without even checking 
there are any bytes availbale to decode the fields.

Either we do those pre-check - and that means we totally review the 
implementation, or better, we dump the code which is not used anyway...

> Exceptions found in protocol decoders
> -------------------------------------
>
>                 Key: DIRSERVER-2426
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-2426
>             Project: Directory ApacheDS
>          Issue Type: Bug
>          Components: dhcp, dns, ntp
>    Affects Versions: 2.0.0.AM27
>         Environment: OS: ubuntu:22.04
> openjdk 21.0.10 2026-01-20
>            Reporter: Mikhail Titov
>            Priority: Major
>         Attachments: repros.tar
>
>
> Greetings! Recently I've been fuzzing some codecs (for DhcpMessage, 
> NtpMessage and DnsMessage) and found several crashes I'd like to report. 
> I have created a standalone repro for each target (`repros.tar` is attached). 
> You can reproduce them by going to the appropriate folder and running: 
> {code:bash}
> java -cp .:jars/* <Filename>.java
> {code}
> A brief description of the found crashes for each target is provided below.
> h4. repro_NtpMessage (NtpMessageDecoder - decode)
> - BufferUnderflowException (14)
> h4. repro_DhcpMessage (DhcpMessageDecoder - decode)
> - NegativeArraySizeException (1)
> - ArrayIndexOutOfBoundsException (1)
> - BufferUnderflowException (19)
> h4. repro_DnsMessage
> I sorted different types of Exceptions to a several folders. To reproduce you 
> might want to change the _dirName_ in _DnsMessageRepro.java_ to an 
> appropriate folder name. 
> There are also a lot of crashes of types _BufferUnderflowException _(6579), 
> _IllegalArgumentException_ (1792) and _IndexOutOfBoundsException_ (1613). I 
> don't think it's worth considering each of them carefully, but they may be 
> useful for checking the fix.
> The following exceptions were also found:
> - StackOverflowError (4) in DnsMessageDecoder - decode
> - NegativeArraySizeException (6) in DnsMessageDecoder - decode
> - ClassCastException (6) in DnsMessageEncoder - encode
> What do you think about handling some of these exceptions in the calling 
> function, adding information about them to the documentation or adding 
> "throws" keyword to a method declaration?
> Best regards,
> Mikhail



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to