I suggest that you count only the best attack for each player. The second attack would be a back-up, if you missed your first one, or in case of a crash. Everything else stays the same. Which means in the case of a 40v40, you would need 40x 5 stars attacks, one for each player, on each opponents, bases. It would fix both problems very easy. Stacking would still be allowed, but would be useless because your bottom would have to perform as much as your top...and stalemates would be harder, because not everybody always does a 5 star attack. Defense would become as important for number 1 to 40.
To be clear on this suggestion, a player reaching 5 stars on his first try is done for the war. No more where 20 globals can clear 40 bases. Nexon has to make it so that sandbagging is disadvantage. If all your players need to have a good attack, alliances who are all close in levels, being disadvantaged right now, would have the advantage then.