I managed to solve this problem. First of all I have changed the LwIP addresses in linker script like this:
.lwip_sec (NOLOAD) :
{
. = ABSOLUTE(0x30000000);
*(.RxDecripSection)
. = ABSOLUTE(0x30000200);
*(.TxDecripSection)
. = ABSOLUTE(0x30000400);
*(.RxPool)
} >RAM_D2
The DMA Descriptors starts at the address 0x30000000, and together they occupy 608 bytes, i.e. 0x200 + 4×24. The Heap size is set to 16KB and the Heap pointer is set to address 0x30004000. Also, I set the address of the LWIP_RAM_HEAP_POINTER into the MPU configuration with 64KB. I noticed that cubemx generates code with not so good TCP configurations so I changed the TCP_MSS to 1460, the TCP_SND_BUF to 5840 which is equal to 4*TCP_MSS and finally the TCP_SND_QUEUELEN to 16. Subsequently, I increase the size of my default task and it appears to be running successfully for 4 hours and it continues to run.