Changeset 9e26562
- Timestamp:
- 06/16/14 21:12:49 (4 years ago)
- Children:
- d10319
- Parents:
- 859b01
- git-author:
- Erik Ekman <erik@…> (06/16/14 21:12:49)
- git-committer:
- Erik Ekman <erik@…> (06/17/14 18:59:06)
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
CHANGELOG
r859b01 r9e26562 6 6 CHANGES: 7 7 8 2010-02-13: 0.6.0-rc1 "Hotspotify" 8 2014-06-17: 0.6.0 9 - Fix authentication bypass vulnerability; found by Oscar Reparaz. 10 11 2010-02-06: 0.6.0-rc1 "Hotspotify" 9 12 - Fixed tunnel not working on Windows. 10 13 - Any device name is now supported on Windows, fixes #47. -
src/iodined.c
r859b01 r9e26562 117 117 #endif 118 118 119 /* This will not check that user has passed login challenge */ 119 120 static int 120 121 check_user_and_ip(int userid, struct query *q) … … 141 142 tempin = (struct sockaddr_in *) &(q->from); 142 143 return memcmp(&(users[userid].host), &(tempin->sin_addr), sizeof(struct in_addr)); 144 } 145 146 /* This checks that user has passed normal (non-raw) login challenge */ 147 static int 148 check_authenticated_user_and_ip(int userid, struct query *q) 149 { 150 int res = check_user_and_ip(userid, q); 151 if (res) 152 return res; 153 154 if (!users[userid].authenticated) 155 return 1; 156 157 return 0; 143 158 } 144 159 … … 781 796 782 797 if (read >= 18 && (memcmp(logindata, unpacked+1, 16) == 0)) { 783 /* Login ok, send ip/mtu/netmask info */ 784 798 /* Store login ok */ 799 users[userid].authenticated = 1; 800 801 /* Send ip/mtu/netmask info */ 785 802 tempip.s_addr = my_ip; 786 803 tmp[0] = strdup(inet_ntoa(tempip)); … … 811 828 812 829 userid = b32_8to5(in[1]); 813 if (check_ user_and_ip(userid, q) != 0) {830 if (check_authenticated_user_and_ip(userid, q) != 0) { 814 831 write_dns(dns_fd, q, "BADIP", 5, 'T'); 815 832 return; /* illegal id */ … … 847 864 848 865 userid = b32_8to5(in[1]); 849 850 if (check_ user_and_ip(userid, q) != 0) {866 867 if (check_authenticated_user_and_ip(userid, q) != 0) { 851 868 write_dns(dns_fd, q, "BADIP", 5, 'T'); 852 869 return; /* illegal id */ … … 889 906 userid = b32_8to5(in[1]); 890 907 891 if (check_ user_and_ip(userid, q) != 0) {908 if (check_authenticated_user_and_ip(userid, q) != 0) { 892 909 write_dns(dns_fd, q, "BADIP", 5, 'T'); 893 910 return; /* illegal id */ … … 1017 1034 /* Downstream fragsize probe packet */ 1018 1035 userid = (b32_8to5(in[1]) >> 1) & 15; 1019 if (check_ user_and_ip(userid, q) != 0) {1036 if (check_authenticated_user_and_ip(userid, q) != 0) { 1020 1037 write_dns(dns_fd, q, "BADIP", 5, 'T'); 1021 1038 return; /* illegal id */ … … 1052 1069 /* Downstream fragsize packet */ 1053 1070 userid = unpacked[0]; 1054 if (check_ user_and_ip(userid, q) != 0) {1071 if (check_authenticated_user_and_ip(userid, q) != 0) { 1055 1072 write_dns(dns_fd, q, "BADIP", 5, 'T'); 1056 1073 return; /* illegal id */ … … 1085 1102 /* Ping packet, store userid */ 1086 1103 userid = unpacked[0]; 1087 if (check_ user_and_ip(userid, q) != 0) {1104 if (check_authenticated_user_and_ip(userid, q) != 0) { 1088 1105 write_dns(dns_fd, q, "BADIP", 5, 'T'); 1089 1106 return; /* illegal id */ … … 1215 1232 userid = code; 1216 1233 /* Check user and sending ip number */ 1217 if (check_ user_and_ip(userid, q) != 0) {1234 if (check_authenticated_user_and_ip(userid, q) != 0) { 1218 1235 write_dns(dns_fd, q, "BADIP", 5, 'T'); 1219 1236 return; /* illegal id */ … … 1786 1803 if (len < 16) return; 1787 1804 1788 /* can't use check_ user_and_ip() since IP address will be different,1805 /* can't use check_authenticated_user_and_ip() since IP address will be different, 1789 1806 so duplicate here except IP address */ 1790 1807 if (userid < 0 || userid >= created_users) return; 1791 1808 if (!users[userid].active || users[userid].disabled) return; 1809 if (!users[userid].authenticated) return; 1792 1810 if (users[userid].last_pkt + 60 < time(NULL)) return; 1793 1811 … … 1814 1832 login_calculate(myhash, 16, password, users[userid].seed - 1); 1815 1833 send_raw(fd, myhash, 16, userid, RAW_HDR_CMD_LOGIN, q); 1834 1835 users[userid].authenticated_raw = 1; 1816 1836 } 1817 1837 } … … 1820 1840 handle_raw_data(char *packet, int len, struct query *q, int dns_fd, int tun_fd, int userid) 1821 1841 { 1822 if (check_ user_and_ip(userid, q) != 0) {1842 if (check_authenticated_user_and_ip(userid, q) != 0) { 1823 1843 return; 1824 1844 } 1845 if (!users[userid].authenticated_raw) return; 1825 1846 1826 1847 /* Update query and time info for user */ … … 1844 1865 handle_raw_ping(struct query *q, int dns_fd, int userid) 1845 1866 { 1846 if (check_ user_and_ip(userid, q) != 0) {1867 if (check_authenticated_user_and_ip(userid, q) != 0) { 1847 1868 return; 1848 1869 } 1870 if (!users[userid].authenticated_raw) return; 1849 1871 1850 1872 /* Update query and time info for user */ -
src/user.c
ra4f41b r9e26562 79 79 created_users++; 80 80 } 81 users[i].authenticated = 0; 82 users[i].authenticated_raw = 0; 81 83 users[i].active = 0; 82 84 /* Rest is reset on login ('V' packet) */ … … 120 122 ret = -1; 121 123 for (i = 0; i < USERS; i++) { 122 if (users[i].active && !users[i].disabled && 124 if (users[i].active && 125 users[i].authenticated && 126 !users[i].disabled && 123 127 users[i].last_pkt + 60 > time(NULL) && 124 128 ip == users[i].tun_ip) { … … 172 176 if ((!users[i].active || users[i].last_pkt + 60 < time(NULL)) && !users[i].disabled) { 173 177 users[i].active = 1; 178 users[i].authenticated = 0; 179 users[i].authenticated_raw = 0; 174 180 users[i].last_pkt = time(NULL); 175 181 users[i].fragsize = 4096; -
src/user.h
ra4f41b r9e26562 37 37 char id; 38 38 int active; 39 int authenticated; 40 int authenticated_raw; 39 41 int disabled; 40 42 time_t last_pkt; -
tests/user.c
r8692c7 r9e26562 94 94 95 95 testip = (unsigned int) inet_addr("127.0.0.2"); 96 fail_unless(find_user_by_ip(testip) == -1); 97 98 users[0].authenticated = 1; 99 100 testip = (unsigned int) inet_addr("127.0.0.2"); 96 101 fail_unless(find_user_by_ip(testip) == 0); 97 102 } … … 136 141 137 142 for (i = 0; i < USERS; i++) { 143 users[i].authenticated = 1; 144 users[i].authenticated_raw = 1; 138 145 fail_unless(find_available_user() == i); 146 fail_if(users[i].authenticated); 147 fail_if(users[i].authenticated_raw); 139 148 } 140 149
Note: See TracChangeset
for help on using the changeset viewer.