android_system_core/adb
David 'Digit' Turner 818d641c42 adb: Check sender's socket id when receiving packets.
handle_packet() in adb.c didn't check that when an A_WRTE packet is
received, the sender's local-id matches the socket's peer id.

This meant that a compromised adbd server could sent packets to
the host adb server, spoofing the identity of another connected
device if it could "guess" the right host socket id.

This patch gets rid of the issue by enforcing even more checks
to ensure that all packets comply with the description in
protocol.txt.

+ Fix a bug where closing a local socket associated with a
  remote one would always send an A_CLSE(0, remote-id, "")
  message, though protocol.txt says that should only happen
  for failed opens.

  The issue was that local_socket_close() called
  remote_socket_close() after clearing the remote socket's
  'peer' field.

  The fix introduces a new asocket optional callback,
  named 'shutdown' that is called before that, and is
  used to send the A_CLSE() message with the right ID
  in remote_socket_shutdown().

  Also add some code in handle_packet() to detect
  invalid close commands.

Change-Id: I9098bc8c6e81f8809334b060e5dca4fc92e6fbc9
2013-12-16 17:58:08 +01:00
..
Android.mk Move liblog headers to system/core/include/log 2013-07-24 12:32:39 -07:00
MODULE_LICENSE_APACHE2
NOTICE
OVERVIEW.TXT
SERVICES.TXT adb: Cleanup dead code 2013-04-24 21:31:45 -07:00
adb.c adb: Check sender's socket id when receiving packets. 2013-12-16 17:58:08 +01:00
adb.h adb: Check sender's socket id when receiving packets. 2013-12-16 17:58:08 +01:00
adb_auth.h adb: Fix secure adb when booting with usb attached 2013-02-02 01:19:06 +00:00
adb_auth_client.c mincrypt: support SHA-256 hash algorithm 2013-09-25 09:26:34 -07:00
adb_auth_host.c adb: Create private key with 0600 mode 2012-08-31 12:31:36 -07:00
adb_client.c Improve some adb error logging 2013-10-27 16:56:55 -07:00
adb_client.h Support adb client connect to remote server 2013-01-04 11:00:38 -08:00
backup_service.c
commandline.c Improve some adb error logging 2013-10-27 16:56:55 -07:00
console.c
fdevent.c
fdevent.h
file_sync_client.c Fix a bunch of small system/core bugs. 2013-10-29 14:12:46 -07:00
file_sync_service.c Fix a bunch of small system/core bugs. 2013-10-29 14:12:46 -07:00
file_sync_service.h
framebuffer_service.c Handle screendumps for all framebuffer sizes 2013-09-25 02:43:45 -07:00
get_my_path_darwin.c
get_my_path_freebsd.c
get_my_path_linux.c
get_my_path_windows.c
jdwp_service.c
log_service.c Move liblog headers to system/core/include/log 2013-07-24 12:32:39 -07:00
mutex_list.h adb: Cleanup dead code 2013-04-24 21:31:45 -07:00
protocol.txt adb: Add public key authentification 2012-08-23 00:20:06 -07:00
remount_service.c fs_mgr: make block devices read-only 2013-04-24 08:53:26 -07:00
services.c Don't return immediately from reboot commands. 2013-10-24 11:01:16 -07:00
sockets.c adb: Check sender's socket id when receiving packets. 2013-12-16 17:58:08 +01:00
sockets.dia
sysdeps.h adb: Only use properties on device builds 2013-05-23 10:37:46 -07:00
sysdeps_win32.c Windows adb: initialize on to 1 in disable_tcp_nagle 2013-01-11 16:36:00 +00:00
test_track_devices.c
test_track_jdwp.c
transport.c adb: Handle adb connect in a thread 2013-04-25 12:34:49 -07:00
transport.h
transport_local.c adb: Only use properties on device builds 2013-05-23 10:37:46 -07:00
transport_usb.c
usb_libusb.c adb: Add ability to specify device path 2012-04-20 11:21:14 -07:00
usb_linux.c adb: Add ability to specify device path 2012-04-20 11:21:14 -07:00
usb_linux_client.c FunctionFS: initial implementation 2012-05-31 15:00:41 -07:00
usb_osx.c adb: Add ability to specify device path 2012-04-20 11:21:14 -07:00
usb_vendors.c correct msi usb vendor id. 2013-08-28 10:53:17 +08:00
usb_vendors.h
usb_windows.c am 9dbcbe08: am 9bdedb59: am a36e1aa3: Merge "adb: usb_windows: fix adb connection lost issue" 2012-05-14 08:37:37 -07:00