Attacking And Improving Received Signal Strength Ratio For Secure Localization And Proximity-Based Authentication