Giter Club home page Giter Club logo

go-dots's People

Contributors

dependabot[bot] avatar eurekaeru avatar hongnguyen-tma avatar huanphan-tma avatar lieunguyen-tma avatar morita-lepidum avatar mrdeep1 avatar naga-lep avatar olliv avatar tamnguyen-tma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-dots's Issues

server: Mysql auth with root doesn't work and the real error is hidden

username: root
password:

I couldn't auth with root with nor without a password, the following error was printed.

ERRO[2019-03-23 13:07:41] [Lifetime Mngt Thread]: Failed to get all mitigation from DB
ERRO[2019-03-23 13:07:41] [Lifetime Mngt Thread]: Failed to get all Aliases from DB

For some reason alias.go doesn't print the auth error, even though there is a log.Printf line but I was able to get the real error by adding withError to active_acl_alias.go. The error was:

error="Error 1698: Access denied for user 'root'@'localhost'"

I don't think the auth issue with root is critical as nobody should do that anyway. However it seems the error logging is somehow broken.

Appending resource parameters by PUT request with alias-name

If the mitigation request
   contains both alias-name and other parameters identifying the target
   resources (such as, target-ip, target-prefix, target-port-range,
   fqdn, or uri) then the DOTS server appends the parameter values in
   alias-name with the corresponding parameter values in target-ip,
   target-prefix, target-port-range, fqdn, or uri.

One decode attempt of 9 bytes of bad CBOR data can exhaust memory (UnmarshalCbor in dots_common/messages/message.go)

@lieunguyen-tma go-dots is using a CBOR library that could exhaust memory in 1 decode attempt of 9-10 bytes of malformed data.

Relevant Code

go-dots/dots_common/messages/message.go

import (
...
	"github.com/ugorji/go/codec"
...
)
...
func UnmarshalCbor(pdu *libcoap.Pdu, typ reflect.Type) (interface{}, error) {
    ...
    m := reflect.New(typ).Interface()
	d := codec.NewDecoderBytes(pdu.Data, dots_common.NewCborHandle())
    err := d.Decode(m)
    ...

Error (fatal error: out of memory)

alt text

For info about CBOR and security, see Section 8 of RFC 7049 (Security Considerations).

For more comparisons, see fxamacker/cbor.

How to Reproduce Problem

To reproduce the problem, attempt to decode 9-10 bytes of malformed CBOR data described in Section 8 of RFC 7049 using nttdots/go-dots function:
func UnmarshalCbor(pdu *libcoap.Pdu, typ reflect.Type) (interface{}, error)

Examples of CBOR data that can exhaust memory can be found on GitHub since Sep 2019 (possibly a lot earlier if you look beyond Go projects).

Background

RFC 7049 was published in 2013 with Section 8 warning of malformed CBOR data being used to exhaust system resources.

In Sep 2019, oasislabs/oasis-core discovered tiny malformed CBOR data can exhaust memory and traced the problem to the same CBOR library (ugorji/go) being used by nttdots/go-dots. They fixed the problem by switching to a more secure CBOR library.

In Feb 2020, smartcontractkit/chainlink had a CBOR security issue involving ugorji/go which was fixed by a GitHub PR titled "Switch to more secure CBOR library".

Decoding 9 bytes of bad CBOR data shouldn't exhaust memory.

Add refresh feature of request with the same mitigation-id

   For the mitigation request to continue beyond the initial negotiated
   lifetime, the DOTS client will need to refresh the current mitigation
   request by sending a new PUT request.  The PUT request MUST use the
   same mitigation-id value, and MUST repeat all the other parameters as
   sent in the original mitigation request apart from a possible change
   to the lifetime parameter value.

Support: One mitigation-scope per mitigation-id

"mitigation-id:  Identifier for the mitigation request
represented using an integer.  This identifier MUST be unique for each
mitigation request bound to the DOTS client, i.e., the mitigation-id parameter
value in the mitigation request needs to be unique relative to the mitigation-
id parameter values of active mitigation requests conveyed from the DOTS
client to the DOTS server. 

This will simplify the code.

Default port number of signal channel

4646(dedicated) or 5684(CoAP over DTLS) ?

The default port for DOTS signal channel is 5684 (Section 12.7 in [RFC7252] and Section 10.4 in [I-D.ietf-core-coap-tcp-tls])

Conflicts with draft-ietf-dots-signal-channel

DOTS_protocol_specification_cheat_sheet.md refers to Content-Type option for CoAP while it should be called Content-Format. The content format is specified as application/cbor in the doc as well as in the source code but draft-ietf-dots-signal-channel specifies application/dots+cbor.

The URI-Path seems to be incorrect at least the cheat sheet as it specifies /.well-known/dots/v1/mitigate while the draft specifies /.well-known/dots/mitigate. The client code seems to be using the proper format but the server doesn't exactly verify it. By a quick look, it seems the server just looks if mitigate is defined in the URI, which isn't probably wrong as the draft mandates a certain order of options. To me it would sound reasonable to have versioned paths, too bad it's not currently allowed in the draft.

happy eyeballs

Implementation of Happy Eyeballs mechanism.
DOTS server and DOTS client of go-dots can listen on both IPv4 and IPv6, but there is no happy eyeballs mechanism.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.