gchq / gchq/CyberChef

Bug report: IP Address extraction is not consistent when IPv4 address contains leading zeros

Open
#2,008 1 comment 1 reaction 1 assignee Claimed by @gchqdev364 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**
When an IPv4 address contains a leading 0, many tools treat it as octal representation (e.g. https://superuser.com/a/857618). However, when extracting IP addresses using CyberChef, some octal IP addresses are extracted (e.g. `011.012.013.014`), but some are not (e.g. `0377.0377.0377.0377`).

**To Reproduce**
Steps to reproduce the behaviour or a link to the recipe / input used to cause the bug:

1. Go to
2. See that `011.012.013.014` appears in the Output, but not `0377.0377.0377.0377`.

**Expected behaviour**
Either both `011.012.013.014` and `0377.0377.0377.0377` appear in the Output, or neither.

**Screenshots**
![Image](https://github.com/user-attachments/assets/7b38fa31-0b98-4c96-af04-ca52194a061f)

**Desktop (if relevant, please complete the following information):**
- OS: macOS
- Browser: Chrome 134
- CyberChef version: 10.19.4

**Additional context**
The root cause is likely this regular expression:
https://github.com/gchq/CyberChef/blob/d3357d2acd1b2d0ead56130c7182c26b8a0053f2/src/core/operations/ExtractIPAddresses.mjs#L68

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.