The verb
wonder takes an embedded indirect question.
The direct question is: Who was that remark aimed at? [Note the inversion of that remark (the subject) and was (the verb).]
The corresponding indirect question is: ... who that remark was aimed at ... [Note that there is no subject-verb inversion.]
Therefore, you need to place the indirect question after wonder thus:
Everyone was wondering who that remark was aimed at.
____
Very formally, the direct question is: At whom was that remark aimed?
And the indirect: at whom that remark was aimed
So, very formally, you might have:
Everyone was wondering at whom that remark was aimed.
CJ