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

fix data race in race requests #3275

Merged
merged 1 commit into from
Feb 6, 2023
Merged

Conversation

tarunKoyalwar
Copy link
Member

@tarunKoyalwar tarunKoyalwar commented Feb 6, 2023

Proposed changes

  • while atomic.Bool{} to track match status etc . The actual protocol executor in pkg/protocols/common/executor/* used bool which is not concurrency safe and caused panic randomly with race requests (or other conditions were matcher status is used in parallel)
  • this PR fixes above issue and closes data race in race requests #3274

Checklist

  • Pull request is created against the dev branch
  • All checks passed (lint, unit/integration/regression tests etc.) with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@tarunKoyalwar tarunKoyalwar marked this pull request as draft February 6, 2023 10:53
@tarunKoyalwar
Copy link
Member Author

$ ./debug.sh http race-simple
::group::Build nuclei
::endgroup::


::group::Run Integration Test

./nuclei -t http/race-simple.yaml -target http://127.0.0.1:50374 -duc -debug

                     __     _
   ____  __  _______/ /__  (_)
  / __ \/ / / / ___/ / _ \/ /
 / / / / /_/ / /__/ /  __/ /
/_/ /_/\__,_/\___/_/\___/_/   v2.8.8

		projectdiscovery.io

[INF] Using Nuclei Engine 2.8.8 (latest)
[INF] Using Nuclei Templates 9.3.6 (latest)
[INF] Templates added in last update: 30
[INF] Templates loaded for scan: 1
[INF] Targets loaded for scan: 1
[INF] [race-condition-testing] Dumped HTTP request for http://127.0.0.1:50374

GET / HTTP/1.1
Host: 127.0.0.1:50374
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2866.71 Safari/537.36
Connection: close
Content-Length: 10
Accept-Encoding: gzip

test      
[DBG] [race-condition-testing] Dumped HTTP response http://127.0.0.1:50374/

HTTP/1.1 200 OK
Connection: close
Date: Mon, 06 Feb 2023 10:46:56 GMT
Content-Length: 0

[DBG] [race-condition-testing] Dumped HTTP response http://127.0.0.1:50374/

HTTP/1.1 200 OK
Connection: close
Date: Mon, 06 Feb 2023 10:46:56 GMT
Content-Length: 0

[DBG] [race-condition-testing] Dumped HTTP response http://127.0.0.1:50374/

HTTP/1.1 200 OK
Connection: close
Date: Mon, 06 Feb 2023 10:46:56 GMT
Content-Length: 0

[DBG] [race-condition-testing] Dumped HTTP response http://127.0.0.1:50374/

HTTP/1.1 200 OK
Connection: close
Date: Mon, 06 Feb 2023 10:46:56 GMT
Content-Length: 0

[DBG] [race-condition-testing] Dumped HTTP response http://127.0.0.1:50374/

HTTP/1.1 200 OK
Connection: close
Date: Mon, 06 Feb 2023 10:46:56 GMT
Content-Length: 0

[DBG] [race-condition-testing] Dumped HTTP response http://127.0.0.1:50374/

HTTP/1.1 200 OK
Connection: close
Date: Mon, 06 Feb 2023 10:46:56 GMT
Content-Length: 0

[DBG] [race-condition-testing] Dumped HTTP response http://127.0.0.1:50374/

HTTP/1.1 200 OK
Connection: close
Date: Mon, 06 Feb 2023 10:46:56 GMT
Content-Length: 0

[DBG] [race-condition-testing] Dumped HTTP response http://127.0.0.1:50374/

HTTP/1.1 200 OK
Connection: close
Date: Mon, 06 Feb 2023 10:46:56 GMT
Content-Length: 0

[DBG] [race-condition-testing] Dumped HTTP response http://127.0.0.1:50374/

HTTP/1.1 200 OK
Connection: close
Date: Mon, 06 Feb 2023 10:46:56 GMT
Content-Length: 0

[DBG] [race-condition-testing] Dumped HTTP response http://127.0.0.1:50374/

HTTP/1.1 200 OK
Connection: close
Date: Mon, 06 Feb 2023 10:46:56 GMT
Content-Length: 0

[race-condition-testing:status-1] [http] [info] http://127.0.0.1:50374/
[race-condition-testing:status-1] [http] [info] http://127.0.0.1:50374/
[race-condition-testing:status-1] [http] [info] http://127.0.0.1:50374/
[race-condition-testing:status-1] [http] [info] http://127.0.0.1:50374/
[race-condition-testing:status-1] [http] [info] http://127.0.0.1:50374/
[race-condition-testing:status-1] [http] [info] http://127.0.0.1:50374/
[race-condition-testing:status-1] [http] [info] http://127.0.0.1:50374/
[race-condition-testing:status-1] [http] [info] http://127.0.0.1:50374/
[race-condition-testing:status-1] [http] [info] http://127.0.0.1:50374/
[race-condition-testing:status-1] [http] [info] http://127.0.0.1:50374/

@tarunKoyalwar tarunKoyalwar linked an issue Feb 6, 2023 that may be closed by this pull request
@tarunKoyalwar tarunKoyalwar marked this pull request as ready for review February 6, 2023 15:32
@tarunKoyalwar tarunKoyalwar self-assigned this Feb 6, 2023
Copy link
Member

@Mzack9999 Mzack9999 left a comment

Choose a reason for hiding this comment

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

lgtm - nice catch!

@Mzack9999 Mzack9999 merged commit 1128969 into dev Feb 6, 2023
@Mzack9999 Mzack9999 deleted the issue-3274-data-race-raceReq branch February 6, 2023 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

data race in race requests
2 participants