Yes and no !
The submarine can only attack ships located in the bases or in the brown-yellow fields. BUT you lose the submarine. You destroy the enemy ship but your submarine leaves the game too. Only these three ships can always use the yellow-brown squares – minelayer, minesweeper and desant ship (landing craft).