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

Avoid slicing errors due to incorrect serial numbers #222

Conversation

pbuff07
Copy link
Contributor

@pbuff07 pbuff07 commented Mar 24, 2023

Some websites may use https certificates, but the format is problematic because the certificates are not issued by an authority.
For example website: https://12345.cnts.gov.cn/
1679654266595

If the original code is used to handle it, a panic exception will occur (the slice operation does not consider the length problem, ./tlsx16 represents tlsx version 1.6)
1679654413563

So I added if to judge whether the value of the large integer serial number is 0, if not 0, the serial number is normal, otherwise the return serial number field is empty
image

1679654637636

ehsandeep and others added 5 commits March 14, 2023 17:41
Bumps [google.golang.org/protobuf](https://github.com/protocolbuffers/protobuf-go) from 1.29.0 to 1.29.1.
- [Release notes](https://github.com/protocolbuffers/protobuf-go/releases)
- [Changelog](https://github.com/protocolbuffers/protobuf-go/blob/master/release.bash)
- [Commits](protocolbuffers/protobuf-go@v1.29.0...v1.29.1)

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
…bot/go_modules/google.golang.org/protobuf-1.29.1

chore(deps): bump google.golang.org/protobuf from 1.29.0 to 1.29.1
@ehsandeep ehsandeep changed the base branch from main to dev March 24, 2023 12:25
@ehsandeep ehsandeep linked an issue Mar 26, 2023 that may be closed by this pull request
@ehsandeep ehsandeep added the Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors. label Mar 26, 2023
Copy link
Member

@ehsandeep ehsandeep left a comment

Choose a reason for hiding this comment

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

echo 12345.cnts.gov.cn | ./tlsx -json | jq .
  

  _____ _    _____  __
 |_   _| |  / __\ \/ /
   | | | |__\__ \>  < 
   |_| |____|___/_/\_\	v1.0.6

		projectdiscovery.io

[INF] Current tlsx version v1.0.6 (latest)
[INF] Connections made using crypto/tls: 1, zcrypto/tls: 0, openssl: 0
{
  "timestamp": "2023-03-27T00:19:43.004822+05:30",
  "host": "12345.cnts.gov.cn",
  "ip": "59.37.165.158",
  "port": "443",
  "probe_status": true,
  "tls_version": "tls12",
  "cipher": "TLS_RSA_WITH_AES_128_CBC_SHA",
  "self_signed": true,
  "mismatched": true,
  "not_before": "2020-10-11T07:11:55Z",
  "not_after": "2040-10-06T07:11:55Z",
  "subject_dn": "CN=H3C-HTTPS-Self-Signed-Certificate-9ae87f1ca5b084c1",
  "subject_cn": "H3C-HTTPS-Self-Signed-Certificate-9ae87f1ca5b084c1",
  "issuer_dn": "CN=H3C-HTTPS-Self-Signed-Certificate-9ae87f1ca5b084c1",
  "issuer_cn": "H3C-HTTPS-Self-Signed-Certificate-9ae87f1ca5b084c1",
  "fingerprint_hash": {
    "md5": "d7ac083962bad52ecb4e160bf679472c",
    "sha1": "42b67b7540ba2d2e90465046eb163609b459e7f5",
    "sha256": "6abcb846d70ab5776f41d12d26b3e14d3c0f0e9f7445609726e28a12c8b43080"
  },
  "tls_connection": "ctls",
  "sni": "12345.cnts.gov.cn"
}

Copy link
Member

@tarunKoyalwar tarunKoyalwar left a comment

Choose a reason for hiding this comment

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

lgtm !

$ go run . -u 12345.cnts.gov.cn -se
  

  _____ _    _____  __
 |_   _| |  / __\ \/ /
   | | | |__\__ \>  < 
   |_| |____|___/_/\_\	v1.0.6

		projectdiscovery.io

[INF] Current tlsx version v1.0.6 (latest)
12345.cnts.gov.cn:443 []
[INF] Connections made using crypto/tls: 1, zcrypto/tls: 0, openssl: 0

@ehsandeep ehsandeep merged commit 586245c into projectdiscovery:dev Mar 26, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

slice bounds out of range error due to incorrect serial numbers
3 participants