I ran into the same issue here. I see this happen when I attempt to SSH using the anonymous user:
~ ssh anonymous@nas
Synology strongly advises you not to run commands as the root user, who has
the highest privileges on the system. Doing so may cause major damages
to the system. Please note that if you choose to proceed, all consequences are
at your own risk.
Permission denied, please try again.
Connection to nas closed.
So it does appear like the login is successful before you get booted out. There are a couple of ways to remedy this:
Method 1 - False Positive:
Mark this as a false positive in Greenbone.
Method 2 - Expire anonymous user:
Per this post, you can run synouser to modify certain user properties. I was able to use this to expire the anonymous account.
Login to the NAS via SSH and switch to the root user. Here are the commands:
~ which synouser
/usr/syno/sbin/synouser
~ synouser --get anonymous
User Name : [anonymous]
User Type : [AUTH_LOCAL]
User uid : [21]
Primary gid : [21]
Fullname : []
User Dir : [/nonexist]
User Shell : [/usr/bin/nologin]
Expired : [false]
User Mail : []
Alloc Size : [102]
Member Of : [1]
(21) ftp
Notice the Expired attribute. Here are the operations that can be performed with synouser.
~ synouser --help
Copyright (c) 2003-2022 Synology Inc. All rights reserved.
Usage: synouser
--help
--rebuild {all|(domain Force{0|1})|(ldap Force{0|1})}
--enum {local|domain|ldap|all|domain_used}
--enumpre {local|domain|all|domain_used} prefix Caseless{0|1}
--enumsub {local|domain|all|domain_used} substr Caseless{0|1}
--enum_admin {local|domain|ldap|all}
--get username
--getuid UID
--add [username pwd "full name" expired{0|1} mail privilege]
--modify username "full name" expired{0|1} mail
--rename old_username new_username
--setpw username newpasswd
--del username1 username2 ...
--login username pwd
--dbopen2 username
--filesetpw
--create_homes {domain|ldap}
Looking at the documentation of the command, we need to modify the user.
~ synouser --modify anonymous "" 1 ""
~ synouser --get anonymous
User Name : [anonymous]
User Type : [AUTH_LOCAL]
User uid : [21]
Primary gid : [21]
Fullname : []
User Dir : [/nonexist]
User Shell : [/usr/bin/nologin]
Expired : [true]
User Mail : []
Alloc Size : [103]
Member Of : [1]
(21) ftp
Now we’ve expired the user and SSH logins fail:
~ ssh anonymous@nas
Your account has expired; please contact your system administrator
Connection closed by 192.168.1.1 port 22
Personally this is what I’ve done as I would never allow FTP access to my NAS, let alone anonymous FTP access.
It goes without saying that if you rely on anonymous FTP access to your NAS, that will no longer work.
The only question that remains is: will this change stick after DSM updates? That remains to be seen as I do not have any pending updates to apply.
Method 3 - Update sshd_config:
In /etc/ssh/sshd_config, uncomment the following line:
#PermitEmptyPasswords no
So it should look like this:
PermitEmptyPasswords no
Restart the SSH service. This is for DSM 7 at the time of writing. Find the appropriate command for your DSM version or reboot your NAS.
synosystemctl restart sshd.service
This should also disallow anonymous logins going forward.
I’ve also read that DSM updates overwrite the sshd_config files so you might have to repeat these steps after a DSM update.