Actions
Bug #14268
closedHeap-use-after-free in `http_server_clean_close` test
Start date:
01/20/2026
Due date:
% Done:
0%
Estimated time:
Description
Problem¶
A heap-use-after-free crash was identified in the test.http executable, specifically in the http_server_clean_close test case when running it multiple times (floating bug) on Ubuntu 24.04 with AddressSanitizer (ASan) enabled.
Probably, the root Cause¶
The crash occurs during server shutdown in http::server::Server::handleStop().
handleStop()callstcp_listeners_.clear(), which destroys theTcpListenerobjects.- Each
TcpListenerowns anew_connection(TcpConnectionPtr), which in turn owns anasio::ip::tcp::socket. - However, an asynchronous
async_accept()operation might still be pending on that socket. - When
asioattempts to cancel the pending operation (due to the acceptor closing), it accesses the socket object that has already been freed.
ASan Trace Highlights¶
- Freed by:
http::server::TcpConnection::~TcpConnection()called viatcp_listeners_.clear()inServer::handleStop(). - Read (UAF):
boost::asio::detail::io_object_impl<...>::get_service()within the asio accept completion chain.
How to Reproduce¶
- Was reproduced on current master and on 4.10.3
- Use an environment with Ubuntu 24.04.
- Build
wtwith tests and ASan enabled:cmake -DBUILD_TESTS=ON -DCMAKE_CXX_FLAGS="-fsanitize=address" ... make - Run the specific test case under stress:
for i in {1..100}; do ./test.http --run_test=http_server_clean_close || break; doneThe crash usually occurs within 20 iterations.
Updated by Romain Mardulyn about 2 months ago
- Status changed from New to InProgress
- Priority changed from Normal to High
- Target version set to 4.12.3
Updated by Romain Mardulyn about 2 months ago
- Status changed from InProgress to Review
Updated by Romain Mardulyn about 1 month ago
- Status changed from Review to Implemented @Emweb
- Assignee set to Romain Mardulyn
Updated by Romain Mardulyn about 1 month ago
- Status changed from Implemented @Emweb to InProgress
Updated by Romain Mardulyn about 1 month ago
- Target version changed from 4.12.3 to 4.12.4
Updated by Romain Mardulyn about 1 month ago
- Status changed from InProgress to Review
- Assignee deleted (
Romain Mardulyn)
Updated by Romain Mardulyn 29 days ago
- Target version changed from 4.12.4 to 4.12.6
Updated by Raf Pauwels 19 days ago
- Status changed from Review to Resolved
- Assignee changed from Raf Pauwels to Romain Mardulyn
Updated by Romain Mardulyn 18 days ago
- Status changed from Resolved to Implemented @Emweb
Updated by Romain Mardulyn 14 days ago
- Status changed from Implemented @Emweb to Closed
- Private changed from Yes to No
Actions