alpine 3.7
format weakness #13


Weakness Breakdown


A format string exploit occurs when the data of an input string is evaluated as a command by the program. This class of attacks is very similar to buffer overflows since an attacker could execute code, read the stack or cause new behaviors that compromise security. Learn more about format string attacks on OWASP attack index.

Warning code(s):

If format strings can be influenced by an attacker, they can be exploited.

File Name:



The highlighted line of code below is the trigger point of this particular Alpine 3.7 format weakness.

 extern char *strrchr(const char *, int);
extern char *strstr(const char *s1, const char *s2);
extern size_t strlen(const char *);
extern long strtol(const char *, char **, int);

extern aptr_t memset(aptr_t, int, size_t);
extern aptr_t memcpy(aptr_t, const aptr_t, size_t);
extern aptr_t memmove(aptr_t, const aptr_t, size_t);
extern aptr_t memchr(const aptr_t, int, size_t);
extern int memcmp(const aptr_t, const aptr_t, size_t);
#endif /* ! defined(HAVE_STRING_H) && ! defined(HAVE_STRINGS_H) */

#ifndef VMS
extern char *strerror(int);
extern char *strerror(int,...);

#if ! defined(__GNU_LIBRARY__)
extern size_t strftime(char *, size_t, const char *, const struct tm *);
extern time_t time(time_t *);

extern FILE *fdopen(int, const char *);
extern int fprintf(FILE *, const char *, ...);
#if ! defined(__GNU_LIBRARY__)
extern size_t fwrite(const aptr_t, size_t, size_t, FILE *);
extern int fputs(const char *, FILE *);
extern int unlink(const char *);
extern int fflush(FILE *);
extern int fclose(FILE *);
extern FILE *popen(const char *, const char *);
extern int pclose(FILE *);
extern void abort();
extern int isatty(int);
extern void exit(int);
extern int system(const char *);
extern int sscanf(const char *, const char *, ...);
#ifndef toupper
extern int toupper(int);
#ifndef tolower
extern int tolower(int);

extern double pow(double x, double y);
extern double atof(const char *);
extern double strtod(const char *, char **);
extern int fstat(int, struct stat *); 

The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.