Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: Add fuzzing harness for AS-mapping (asmap) #18029

Merged
merged 2 commits into from Feb 5, 2020

Conversation

practicalswift
Copy link
Contributor

@practicalswift practicalswift commented Jan 30, 2020

Add fuzzing harness for AS-mapping (asmap).

To test this PR:

$ make distclean
$ ./autogen.sh
$ CC=clang CXX=clang++ ./configure --enable-fuzz \
      --with-sanitizers=address,fuzzer,undefined
$ make
$ src/test/fuzz/asmap
…

@MarcoFalke
Copy link
Member

@MarcoFalke MarcoFalke commented Jan 30, 2020

ACK 4d2acea

Copy link
Member

@jonatack jonatack left a comment

ACK 4d2acea

Code review, test. Fuzz output: https://gist.github.com/jonatack/5d78f682e0b245455192567d6af12b7e

PR #17812 adds test coverage as well (review beg).

@@ -39,7 +39,6 @@ class CNetAddr
explicit CNetAddr(const struct in_addr& ipv4Addr);
void SetIP(const CNetAddr& ip);

private:
Copy link
Member

@jonatack jonatack Feb 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public: at line 48 now redundant, can be removed as well?

@jonatack
Copy link
Member

@jonatack jonatack commented Feb 2, 2020

Tested #18023 for 18 hours and 72M execs with this fuzzer (before that patch it found a heap buffer overflow immediately, as shown in https://gist.github.com/jonatack/5d78f682e0b245455192567d6af12b7e):

#72474660 REDUCE cov: 1198 ft: 3529 corp: 197/12792b exec/s: 1063 rss: 452Mb L: 41/1527 MS: 4 InsertByte-EraseBytes-InsertByte-PersAutoDict- DE: "\x00 \x00\x00\x00\x00\x00\x00"-

laanwj added a commit that referenced this issue Feb 5, 2020
4d2acea tests: Add fuzzer asmap to FUZZERS_MISSING_CORPORA (temporarily) (practicalswift)
8d07706 tests: Add fuzzing harness for AS-mapping (asmap) (practicalswift)

Pull request description:

  Add fuzzing harness for AS-mapping (`asmap`).

  To test this PR:

  ```
  $ make distclean
  $ ./autogen.sh
  $ CC=clang CXX=clang++ ./configure --enable-fuzz \
        --with-sanitizers=address,fuzzer,undefined
  $ make
  $ src/test/fuzz/asmap
  …
  ```

ACKs for top commit:
  MarcoFalke:
    ACK 4d2acea
  jonatack:
    ACK 4d2acea

Tree-SHA512: bc4c63b48cd98c0cec9d10ecb43775b1bf1215241ff821fc7a866c7e2738605641fb88d044eabf2f48a8c16f2ced9ffce5165c9e6a83c73ece004350da7153e7
@laanwj laanwj merged commit 4d2acea into bitcoin:master Feb 5, 2020
2 checks passed
sidhujag pushed a commit to syscoin/syscoin that referenced this issue Feb 9, 2020
4d2acea tests: Add fuzzer asmap to FUZZERS_MISSING_CORPORA (temporarily) (practicalswift)
8d07706 tests: Add fuzzing harness for AS-mapping (asmap) (practicalswift)

Pull request description:

  Add fuzzing harness for AS-mapping (`asmap`).

  To test this PR:

  ```
  $ make distclean
  $ ./autogen.sh
  $ CC=clang CXX=clang++ ./configure --enable-fuzz \
        --with-sanitizers=address,fuzzer,undefined
  $ make
  $ src/test/fuzz/asmap
  …
  ```

ACKs for top commit:
  MarcoFalke:
    ACK 4d2acea
  jonatack:
    ACK 4d2acea

Tree-SHA512: bc4c63b48cd98c0cec9d10ecb43775b1bf1215241ff821fc7a866c7e2738605641fb88d044eabf2f48a8c16f2ced9ffce5165c9e6a83c73ece004350da7153e7
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this issue Nov 1, 2020
Summary:
Backport of core [[bitcoin/bitcoin#18029 | PR18029]].

The missing corpora change is not relevant for us.
The `netaddress.h` change was already done in D8200.

Test Plan:
  ninja bitcoin-fuzzers
  ./test/fuzz/test_runner.py <path_to_corpus>

Reviewers: #bitcoin_abc, PiRK

Reviewed By: PiRK

Differential Revision: https://reviews.bitcoinabc.org/D8216
sidhujag pushed a commit to syscoin-core/syscoin that referenced this issue Nov 10, 2020
4d2acea tests: Add fuzzer asmap to FUZZERS_MISSING_CORPORA (temporarily) (practicalswift)
8d07706 tests: Add fuzzing harness for AS-mapping (asmap) (practicalswift)

Pull request description:

  Add fuzzing harness for AS-mapping (`asmap`).

  To test this PR:

  ```
  $ make distclean
  $ ./autogen.sh
  $ CC=clang CXX=clang++ ./configure --enable-fuzz \
        --with-sanitizers=address,fuzzer,undefined
  $ make
  $ src/test/fuzz/asmap
  …
  ```

ACKs for top commit:
  MarcoFalke:
    ACK 4d2acea
  jonatack:
    ACK 4d2acea

Tree-SHA512: bc4c63b48cd98c0cec9d10ecb43775b1bf1215241ff821fc7a866c7e2738605641fb88d044eabf2f48a8c16f2ced9ffce5165c9e6a83c73ece004350da7153e7
@practicalswift practicalswift deleted the fuzzers-asmap branch Apr 10, 2021
random-zebra added a commit to PIVX-Project/PIVX that referenced this issue Jul 30, 2021
16791f2 CMakeLists tests: add raw files generation. (furszy)
672d9a2 init: move asmap code earlier in init process (Jon Atack)
65cd143 net: extract conditional to bool CNetAddr::IsHeNet (Jon Atack)
2fc1f37 logging: asmap logging and #include fixups (Jon Atack)
0c9efb8 test: add functional test for an empty, unparsable asmap (Jon Atack)
6545656 config: separate the asmap finding and parsing checks (Jon Atack)
618b8d1 config: enable passing -asmap an absolute file path (Jon Atack)
8c7bdbe config: use default value in -asmap config (Jon Atack)
de39fab test: add feature_asmap functional tests (Jon Atack)
4290d3f Make asmap Interpret tolerant of malicious map data (Pieter Wuille)
e527e04 Use ASNs for mapped IPv4 addresses correctly (Pieter Wuille)
9a28bc0 Mark asmap const in statistics code (Pieter Wuille)
868a6ed Avoid asmap copies in initialization (Pieter Wuille)
cb698fb Add extra logging of asmap use and bucketing (Gleb Naumenko)
2fe5a05 Return mapped AS in RPC call getpeerinfo (Gleb Naumenko)
ce7aa15 scripted-diff: Replace NET_TOR with NET_ONION (wodry)
4c3ae7d Integrate ASN bucketing in Addrman and add tests (Gleb Naumenko)
718f1df CAddrManTest: remove redundant MakeDeterministic call. (furszy)
fd51941 Tests: address placement should be deterministic by default (René Nyffenegger)
8d01cbd  Add asmap utility which queries a mapping (Gleb Naumenko)
e986ed0 CAddrMan::Deserialize handle corrupt serializations better. (Patrick Strateman)
d2a8baf addrman.h: CAddrInfo inline members default values, plus several typos corrected. (furszy)
a7b9fd9 refactor: Use uint16_t instead of unsigned short (furszy)

Pull request description:

  Decoupled from #2411, built on top of #2479. Probably the last decouple from the "road to Tor" work.

  Focused on porting the ASN nodes bucketing functionality. The hearth of this work is bitcoin#16702.

  Providing an asmap file that contains the IP->ASN mapping, nodes will be bucketed by AS they belong to, in order to make impossible for a node to connect to several nodes hosted in a single AS.
  This is done in response to Erebus attack, but also to generally diversify the connections every node creates, especially useful when a large fraction of nodes operate under a couple of cloud providers.

  #### List of PRs:
  * bitcoin#7932
  * bitcoin#10765
  * bitcoin#13532
  * bitcoin#13575
  * bitcoin#16702
  * bitcoin#17812
  * bitcoin#18023
  * bitcoin#19314

  PRs for a follow up PR:
  * bitcoin#18029
  * bitcoin#18512

ACKs for top commit:
  random-zebra:
    re-utACK 16791f2
  Fuzzbawls:
    ACK 16791f2

Tree-SHA512: 1452af87d693526d3359822845bbd6211578b5c7c69d740d19c8c3ee25c66fd6e130f4421066a8f5384d62f65a2754423c633f90d7e3d809f4f1cc00c3c956ba
kittywhiskers added a commit to kittywhiskers/dash that referenced this issue Feb 27, 2022
kittywhiskers added a commit to kittywhiskers/dash that referenced this issue Feb 27, 2022
kittywhiskers added a commit to kittywhiskers/dash that referenced this issue Feb 28, 2022
kittywhiskers added a commit to kittywhiskers/dash that referenced this issue Feb 28, 2022
kittywhiskers added a commit to kittywhiskers/dash that referenced this issue Feb 28, 2022
kittywhiskers added a commit to kittywhiskers/dash that referenced this issue Mar 13, 2022
kittywhiskers added a commit to kittywhiskers/dash that referenced this issue Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants