Pipe goes into wall like this from under the sink
And then comes out of the wall like this (the short pipe)
https://www.stlegerhomes.co.uk/images/pipe1.jpg[/QUOTE]
Cant work out what the white piece is before the grey pipe, it dosent look like a proper waste fitting to me, is it solvent welded onto the grey pipe how is it attached to the trap. It appears to have a slight bend as well. Is this the bit that is loose.
Your outside fitting looks like a push fitting a bit of mortar around the elbow will help to secure it.