0

I'd like to know if some measure is possible to prevent the capturing of packets that are being sent on Android.

I'd need the solution to work via code (cannot rely on external tools).

Packets are already encrypted, but it would be a nice plus if they couldn't be captured, or, at least, that it would be difficult to.

Is anything like this possible or is there no way to prevent capture of a packet via packet capture software?

7
  • How similar to Wireshark do you mean? You can transfer data through audio (I think most phones have a speaker and microphone, but don't quote me on that), but it would be pretty trivial to make a tool to listen in on it.
    – user
    Jul 20 at 18:55
  • @user, no it's data that must be sent to a server computer,have to stick to TCP/IP packets. Jul 20 at 18:58
  • Is rooting the phone enough of a barrier? Once you have root access, you have access to everything. But you could prevent packet capture on a unrooted phone.
    – schroeder
    Jul 20 at 19:08
  • @schroeder, if at least it can be prevented in unrooted phones, it's better than nothing. We are considering to maybe avoid using the app to rooted phones, anyway. Jul 20 at 19:10
  • @schroeder, I just installed one, and it even says that no root is needed when starting it (at least for that one). Jul 20 at 19:14
3

It's literally impossible.

You can't stop someone from capturing packets once they're handed over from the Android system to the next hop in the network. If you somehow manage to prohibit someone from capturing on the phone, they can still capture on their wifi.

Furthermore, trying to stop it on the phone is just silly. Any determined attacker will spend three minutes setting up a capture on their wifi.

It's simply a function of how TCP/IP works.

Trying to prevent using the Wi-Fi isn't going to prevent someone else somewhere on the network from capturing or inspecting it. Making users' lives difficult for this reason is security theatre and will only serve to waste people's time and irritate people. You always have to assume the network is untrusted and that everybody can see and intercept your packets.

From comment by bk2204.

This is universally true. What ever you are trying to achieve, you're doing it the wrong way.

9
  • We can forbid using wifi, that was thought, anyway no possible way to not capture it in phone, right? Jul 20 at 21:09
  • 2
    OK, so I have to decompile your app. Or set up a private cell using SDR. Whatever you're planning sounds like security through obscurity. That doesn't work. If data is encrypted, why do you care about who sees your packets?
    – vidarlo
    Jul 20 at 22:24
  • @bkk2204, I don't care about other people seeing packets on thw network. What I want to avoid is user intercepting packets in his own phone and changing to other ones he desires. Jul 21 at 2:34
  • @user2638180 "user intercepting packets in his own phone and changing to other ones he desires" I feel this might be an XY-problem and the core of the issue, but not this question is really about. I guess what you really want to do is preventing replay attack? Considering that the request is already encrypted, it'd be more worrying if the user can forge any valid request.
    – Andrew T.
    Jul 21 at 4:12
  • 1
    @user2638180 Authenticated encryption is enough to protect integrity of data. You don't have to come up with a solution to prevent a user from capturing packets.
    – defalt
    Jul 21 at 11:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.