gchq / gchq/CyberChef

Bug report: ExtractIPAddresses function IPv6 matches incorrectly when multiple IPs in one-line

Open
#1,721 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
35.8k
Forks
4.1k
Avg merge
2d 26m
Merged PRs (30d)
33

Description

**Describe the bug**
The original IPv6 regex code in ExtractIPAddresses only worked fine when it matched the whole one-line text, if it has multiple IPs in one line, it will break sometimes.

**To Reproduce**

[https://gchq.github.io/CyberChef/#recipe=Extract_IP_addresses(false,true,false,false,false,false)&input=MjAwMTowZGI4OjAwMDE6MDAwMDowMDAwOjBhYjk6QzBBODowMTAyIGNhbiBiZSBjb21wcmVzc2VkIGFzIGZvbGxvd3M6IDIwMDE6ZGI4OjE6OmFiOTpDMEE4OjEwMi4](https://gchq.github.io/CyberChef/#recipe=Extract_IP_addresses(false,true,false,false,false,false)&input=MjAwMTowZGI4OjAwMDE6MDAwMDowMDAwOjBhYjk6QzBBODowMTAyIGNhbiBiZSBjb21wcmVzc2VkIGFzIGZvbGxvd3M6IDIwMDE6ZGI4OjE6OmFiOTpDMEE4OjEwMi4)

**Expected behaviour**
When multiple IP in one-line, it can be matched correctly.

**Screenshots**
![2024-02-18_09-20](https://github.com/gchq/CyberChef/assets/10971397/c08dec77-a86b-4cd5-9972-966cafe6123c)

**Additional context**
See #1661, fix this issue may need to revert this pull request.

Contributor guide

Open the contributing guide

Research direction

Reproduce the linked CyberChef recipe and inspect ExtractIPAddresses, focusing on IPv6 matching when two addresses share one line. Compare the behavior with the context in #1661 and verify that the expected result returns each IP correctly without breaking the compressed form.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.