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

Try doing a SSL handshake in tls_handshake_recv #7

Open
wants to merge 1 commit into
base: v3.0.25_foxpass
Choose a base branch
from

Conversation

grk-it
Copy link

@grk-it grk-it commented Feb 3, 2022

Try doing a SSL handshake assuming we have all the data required in tls_handshake_recv. If not we try to prepare for more application data to be received which is done using SSL_read

Description of the change

Description here

Type of change

  • Bug fix
  • New feature

Testing

  • Testing information has been added - test cases checklist and steps followed for testing.
  • Testing screenshot(s) attached for more information.

Security

  • This PR has security related considerations.

…tls_handshake_recv`. If not we try to prepare for more application data to be received which is done using `SSL_read`
@grk-it grk-it requested a review from aren February 3, 2022 19:09
@grk-it
Copy link
Author

grk-it commented Feb 3, 2022

Tested both radsec and on eaptest [UDP]

@grk-it grk-it marked this pull request as ready for review February 3, 2022 19:15
aren pushed a commit that referenced this pull request May 25, 2023
Such error when we run: radiusd -CX

Configuration appears to be OK
Allocated memory at time of report:
Current state of talloced memory:
full talloc report on 'null_context' (total   1057 bytes in   4 blocks)
    autofree_context               contains      1 bytes in   2 blocks (ref 0) 0x608000000400
        bool                           contains      1 bytes in   1 blocks (ref 0) 0x60b000044a90
    RADCLIENT_LIST                 contains   1056 bytes in   1 blocks (ref 0) 0x6190000032e0

=================================================================
==43730==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 1152 byte(s) in 1 object(s) allocated from:
    #0 0x5603d1a170be in malloc (/__w/freeradius-server/freeradius-server/build/bin/local/radiusd+0x20b0be) (BuildId: acbe3a0941626cf6f01ae6b2c12df877fb8fc009)
    #1 0x7f2c07e40c86 in _talloc_zero (/lib/x86_64-linux-gnu/libtalloc.so.2+0x6c86) (BuildId: f3c1074a602981acb4683b4df6b7733b104ba7d4)
    #2 0x5603d1a62780 in client_list_init (/__w/freeradius-server/freeradius-server/build/bin/local/radiusd+0x256780) (BuildId: acbe3a0941626cf6f01ae6b2c12df877fb8fc009)
    #3 0x5603d1a62a4a in client_add (/__w/freeradius-server/freeradius-server/build/bin/local/radiusd+0x256a4a) (BuildId: acbe3a0941626cf6f01ae6b2c12df877fb8fc009)
    #4 0x5603d1a6b713 in client_list_parse_section (/__w/freeradius-server/freeradius-server/build/bin/local/radiusd+0x25f713) (BuildId: acbe3a0941626cf6f01ae6b2c12df877fb8fc009)
    #5 0x5603d1ae8532 in main_config_init (/__w/freeradius-server/freeradius-server/build/bin/local/radiusd+0x2dc532) (BuildId: acbe3a0941626cf6f01ae6b2c12df877fb8fc009)
    #6 0x5603d1b45bc4 in main (/__w/freeradius-server/freeradius-server/build/bin/local/radiusd+0x339bc4) (BuildId: acbe3a0941626cf6f01ae6b2c12df877fb8fc009)
    #7 0x7f2c07981082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
    #8 0x5603d19924fd in _start (/__w/freeradius-server/freeradius-server/build/bin/local/radiusd+0x1864fd) (BuildId: acbe3a0941626cf6f01ae6b2c12df877fb8fc009)

SUMMARY: AddressSanitizer: 1152 byte(s) leaked in 1 allocation(s).
aren pushed a commit that referenced this pull request May 25, 2023
Such error:

Current state of talloced memory:
full talloc report on 'null_context' (total      0 bytes in   1 blocks)

=================================================================
==85543==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 96 byte(s) in 1 object(s) allocated from:
    #0 0x5598fcd87f3e in malloc (/home/jpereira/Devel/FreeRADIUS/freeradius-server-v3.2.x.git-linux/build/bin/local/radiusd+0x20cf3e) (BuildId: 3bf5bfb4fd72e1e1112726414556f8a4f339789f)
    #1 0x7f1cc4453d7f in __talloc_with_prefix /build/talloc-NvEq5A/talloc-2.3.3/bin/default/../../talloc.c:783:9
    #2 0x7f1cc4455a5d in __talloc /build/talloc-NvEq5A/talloc-2.3.3/bin/default/../../talloc.c:825:9
    #3 0x7f1cc4455a5d in _talloc_named_const /build/talloc-NvEq5A/talloc-2.3.3/bin/default/../../talloc.c:982:8
    #4 0x7f1cc4455a5d in talloc_enable_null_tracking /build/talloc-NvEq5A/talloc-2.3.3/bin/default/../../talloc.c:2353:18
    #5 0x7f1cc4455a5d in talloc_enable_null_tracking /build/talloc-NvEq5A/talloc-2.3.3/bin/default/../../talloc.c:2350:15
    #6 0x5598fceb65b1 in main /home/jpereira/Devel/FreeRADIUS/freeradius-server-v3.2.x.git-linux/src/main/radiusd.c:313:3
    #7 0x7f1cc342350f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #8 0x7f1cc34235c8 in __libc_start_main csu/../csu/libc-start.c:381:3
    #9 0x5598fcd02514 in _start (/home/jpereira/Devel/FreeRADIUS/freeradius-server-v3.2.x.git-linux/build/bin/local/radiusd+0x187514) (BuildId: 3bf5bfb4fd72e1e1112726414556f8a4f339789f)

SUMMARY: AddressSanitizer: 96 byte(s) leaked in 1 allocation(s).
aren pushed a commit that referenced this pull request May 25, 2023
Such error:

Process 369882 stopped
* thread #4, name = 'radiusd', stop reason = Out of bounds index
    frame #0: 0x00005555556e7c10 radiusd`__ubsan_on_report
radiusd`__ubsan_on_report:
->  0x5555556e7c10 <+0>: retq
    0x5555556e7c11:      nopw   %cs:(%rax,%rax)
    0x5555556e7c1b:      nopl   (%rax,%rax)
radiusd`__ubsan_get_current_report_data:
    0x5555556e7c20 <+0>: pushq  %rbx
lldb> vt
error: 'vt' is not a valid command.
lldb> bt
* thread #4, name = 'radiusd', stop reason = Out of bounds index
  * frame #0: 0x00005555556e7c10 radiusd`__ubsan_on_report
    frame #1: 0x00005555556e29c6 radiusd`__ubsan::Diag::~Diag() + 214
    frame #2: 0x00005555556e5814 radiusd`handleOutOfBoundsImpl(__ubsan::OutOfBoundsData*, unsigned long, __ubsan::ReportOptions) + 340
    frame #3: 0x00005555556e588e radiusd`__ubsan_handle_out_of_bounds_abort + 46
    frame #4: 0x00007ffff7e2fd5f libfreeradius-radius.so`fr_rand_seed(data=0x000062501c0aeae0, size=20) at radius.c:5019:45
    frame #5: 0x00007ffff7e2f865 libfreeradius-radius.so`rad_decode(packet=<unavailable>, original=<unavailable>, secret=<unavailable>) at radius.c:4551:2
    frame #6: 0x000055555571631d radiusd`client_socket_decode(listener=<unavailable>, request=<unavailable>) at listen.c:2404:9
    frame #7: 0x000055555575df97 radiusd`request_running [inlined] request_pre_handler(request=0x000062501c0aeb70, action=<unavailable>) at process.c:1379:11
    frame #8: 0x000055555575de92 radiusd`request_running(request=0x000062501c0aeb70, action=<unavailable>) at process.c:1676:8
    frame #9: 0x0000555555758f76 radiusd`request_handler_thread(arg=0x0000606000010880) at threads.c:826:3
    frame #10: 0x00007ffff7490402 libc.so.6`start_thread(arg=<unavailable>) at pthread_create.c:442:8
    frame #11: 0x00007ffff751f590 libc.so.6`__clone3 at clone3.S:81
lldb>
asakapab0i pushed a commit that referenced this pull request Jul 27, 2023
Such error:

Current state of talloced memory:
full talloc report on 'null_context' (total      0 bytes in   1 blocks)

=================================================================
==85543==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 96 byte(s) in 1 object(s) allocated from:
    #0 0x5598fcd87f3e in malloc (/home/jpereira/Devel/FreeRADIUS/freeradius-server-v3.2.x.git-linux/build/bin/local/radiusd+0x20cf3e) (BuildId: 3bf5bfb4fd72e1e1112726414556f8a4f339789f)
    #1 0x7f1cc4453d7f in __talloc_with_prefix /build/talloc-NvEq5A/talloc-2.3.3/bin/default/../../talloc.c:783:9
    #2 0x7f1cc4455a5d in __talloc /build/talloc-NvEq5A/talloc-2.3.3/bin/default/../../talloc.c:825:9
    #3 0x7f1cc4455a5d in _talloc_named_const /build/talloc-NvEq5A/talloc-2.3.3/bin/default/../../talloc.c:982:8
    #4 0x7f1cc4455a5d in talloc_enable_null_tracking /build/talloc-NvEq5A/talloc-2.3.3/bin/default/../../talloc.c:2353:18
    #5 0x7f1cc4455a5d in talloc_enable_null_tracking /build/talloc-NvEq5A/talloc-2.3.3/bin/default/../../talloc.c:2350:15
    #6 0x5598fceb65b1 in main /home/jpereira/Devel/FreeRADIUS/freeradius-server-v3.2.x.git-linux/src/main/radiusd.c:313:3
    #7 0x7f1cc342350f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #8 0x7f1cc34235c8 in __libc_start_main csu/../csu/libc-start.c:381:3
    #9 0x5598fcd02514 in _start (/home/jpereira/Devel/FreeRADIUS/freeradius-server-v3.2.x.git-linux/build/bin/local/radiusd+0x187514) (BuildId: 3bf5bfb4fd72e1e1112726414556f8a4f339789f)

SUMMARY: AddressSanitizer: 96 byte(s) leaked in 1 allocation(s).
asakapab0i pushed a commit that referenced this pull request Jul 27, 2023
Such error when we run: radiusd -CX

Configuration appears to be OK
Allocated memory at time of report:
Current state of talloced memory:
full talloc report on 'null_context' (total   1057 bytes in   4 blocks)
    autofree_context               contains      1 bytes in   2 blocks (ref 0) 0x608000000400
        bool                           contains      1 bytes in   1 blocks (ref 0) 0x60b000044a90
    RADCLIENT_LIST                 contains   1056 bytes in   1 blocks (ref 0) 0x6190000032e0

=================================================================
==43730==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 1152 byte(s) in 1 object(s) allocated from:
    #0 0x5603d1a170be in malloc (/__w/freeradius-server/freeradius-server/build/bin/local/radiusd+0x20b0be) (BuildId: acbe3a0941626cf6f01ae6b2c12df877fb8fc009)
    #1 0x7f2c07e40c86 in _talloc_zero (/lib/x86_64-linux-gnu/libtalloc.so.2+0x6c86) (BuildId: f3c1074a602981acb4683b4df6b7733b104ba7d4)
    #2 0x5603d1a62780 in client_list_init (/__w/freeradius-server/freeradius-server/build/bin/local/radiusd+0x256780) (BuildId: acbe3a0941626cf6f01ae6b2c12df877fb8fc009)
    #3 0x5603d1a62a4a in client_add (/__w/freeradius-server/freeradius-server/build/bin/local/radiusd+0x256a4a) (BuildId: acbe3a0941626cf6f01ae6b2c12df877fb8fc009)
    #4 0x5603d1a6b713 in client_list_parse_section (/__w/freeradius-server/freeradius-server/build/bin/local/radiusd+0x25f713) (BuildId: acbe3a0941626cf6f01ae6b2c12df877fb8fc009)
    #5 0x5603d1ae8532 in main_config_init (/__w/freeradius-server/freeradius-server/build/bin/local/radiusd+0x2dc532) (BuildId: acbe3a0941626cf6f01ae6b2c12df877fb8fc009)
    #6 0x5603d1b45bc4 in main (/__w/freeradius-server/freeradius-server/build/bin/local/radiusd+0x339bc4) (BuildId: acbe3a0941626cf6f01ae6b2c12df877fb8fc009)
    #7 0x7f2c07981082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
    #8 0x5603d19924fd in _start (/__w/freeradius-server/freeradius-server/build/bin/local/radiusd+0x1864fd) (BuildId: acbe3a0941626cf6f01ae6b2c12df877fb8fc009)

SUMMARY: AddressSanitizer: 1152 byte(s) leaked in 1 allocation(s).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant